0

This is my ServiceConnection:

   private ServiceConnection mConnection = new ServiceConnection() {
    public void onServiceConnected(ComponentName className, IBinder service) {
        Log.i("","onServiceConnected TRUE");
        locationService = ((LocationService.ServiceBinder)service).getService();
    }

    public void onServiceDisconnected(ComponentName className) {
        Log.i("","onServiceConnected TRUE DISCONNECT");
        locationService = null;
    }
};

This is never entered. I call it like this:

  void doBindService() {
    bindService(new Intent(this, LocationService.class), mConnection, Context.BIND_AUTO_CREATE);
}

From my ApplicationClass onCreate:

  Intent i= new Intent(PSLocationCenter.this, LocationService.class);
    startService(i);
    doBindService();

And I have this in the Manifest:

   <service android:name=".services.LocationService" android:enabled="true"/>

Am i trying to bind it wrongly? Why is it not called.

rosu alin
  • 5,674
  • 11
  • 69
  • 150

1 Answers1

0

I know this is late, but maybe it will help someone. This answer makes sense: using getApplicatinContext I must admit it hasn't worked for me yet, and I'm still looking, but you seem to have the same problem he had.

Community
  • 1
  • 1
KayO
  • 450
  • 7
  • 16