I am facing a weird issue .On launch of my app I am connecting Activity to service.Service connection is getting established successfully and works fine in Samsung galaxy S5 and other devices too.But in other devices like Moto E , Moto G etc it works only 2 or 3 time after 3 or 4 launch it dose not works at all.
communication between service and Activity is achieved using massenger. I observed that when my app stops working onServiceConnected
is not called but even in this case bindservice returns true. Similar issue Is mentioned here but no answer
This is how I bind the service to an Activity
startService(new Intent(this,MyService.class));
boolean bound = bindService(new Intent(this,MyService.class), serviceConnection, Context.BIND_AUTO_CREATE);//bound is true everytime
Below is onBind Of MyService
public IBinder onBind(Intent intent) {
return messenger.getBinder();
}
Here messenger is an instance of Messenger ,to communicate between activity and service.