My application uses a service launched using BOOT_COMPLETE BroadcastReceiver, for example:
public void onReceive(Context context, Intent intent) { context.startService(new Intent(context, MyService.class)); }
If in action in my application, I try to bind this service as follows:
getApplicationContext().bindService(new Intent(getApplicationContext(), MyService.class), _serviceConnection, Context.BIND_AUTO_CREATE);
a new instance of the Service is created, although the first instance (created by BroadcastReceiver) is still running. I registered process identifiers in the onCreate () method of the service and the first service starts in a different process than the action, the second instance is created in the same process as the activity. I tried to set the android: process argument in the manifest service element (both with and without the host), but the result remains the same.
How do I bind a service running in another process, instead of creating a new instance of the process in which the action is performed?
source share