How can I get the service reference in a child activity.
Basically I started a service called “A” in activity1, I pass the intent to activity2 and started the activity2. How can I get the reference of my service “A” in activity2.
code in Activity1:
getApplicationContext().bindService(new Intent (this, AndroidUpnpServiceImpl.class), serviceConnection, Context.BIND_AUTO_CREATE);
It will start the service and bind the service to serviceConnection
Now I want the reference of same service in activity2
Thanks.
Looks like you can simply call bindService in your activity2; services are singletons so another service object will not be spawned but you’ll connect to the existing one.
Check the discussion regarding this topic.