I am trying to bind a service, but onBind() always returns false.
This is the code for ServiceConnection -
private ServiceConnection mConnection = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder service) {
This is a call to bindService() -
boolean test = getApplicationContext().bindService(new Intent(this, ScheduleService.class), mConnection, Context.BIND_AUTO_CREATE);
This is a service declaration in the manifest -
<service android:name=".Notifications.ScheduleService" android:enabled="true"/>
I read the previous questions on the topic and could not find the answer (I tried switching the context of the Activity with the application context, but this did not help).
I use Frgaments and ActionBarSherlock, and my Activity extends SlidingFragmentActivity (This is why I use an application context that does not help).
Edit is the code of the service I'm trying to start -
public class ScheduleService extends Service { public class ServiceBinder extends Binder { public ScheduleService getService() { return ScheduleService.this; } } @Override public int onStartCommand(Intent intent, int flags, int startId) { Log.i("ScheduleService", "Received start id " + startId + ": " + intent);
Any help would be appreciated. Thanks.