Hi all, I have a service that starts and binds correctly when it's first called, but successive bindings to that same service fail when called by other activities.
The code:
activity.startService(new Intent().setClass(activity, ServerListenerService.class));
xmppServiceConnection = new ServiceConnection() {
public void onServiceDisconnected(ComponentName name) {
ServerActivityConnection.this.xmppService = null;
}
public void onServiceConnected(ComponentName name, IBinder binder) {
//set everything up
}
};
activity.bindService(new Intent().setClass(activity, ServerListenerService.class), xmppServiceConnection, Activity.BIND_AUTO_CREATE);
The second time around, after the call to activity.bindService
, the serviceconnection's onServiceConnected
method never gets called. I use a connection class that does the binding, so the method is the same for both activities. The service is also correctly added the manifest file.
Any ideas?
Many Thanks