I have 2 separate Apps A and B.
Application B has a service inside it and at one point, Application A communicates with App B by binding to B's service and exchanging some messages (using a Messenger
).
On almost all devices, this process works completely fine. However, on a OnePlus 5 device, whenever A tries to bind the B's service, it always fails unless B has been opened and is sitting in the background. And if you swipe B from the task drawer (killing it), the service binding fails again.
When I say service binding fails, I mean context.bindService()
returns false. And so far, I've only noticed this behaviour on a OnePlus 5 device.
Does this indicate something wrong on the OnePlus 5 device alone? Or is there something else that could possibly be causing this issue.
If it helps, this is how I bind to the service:
Intent intent = new Intent();
intent.setComponent(new ComponentName(packageNameOfB, classNameOfBService));
MyServiceConnection connection = new MyServiceConnection();
context.bindService(intent, connection, Context.BIND_AUTO_CREATE);