Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Get an instance from a service running

I have a service running in background. I started it from an Activity, but I want to recover an instance of that service from another activity (in the same app) in order to call one method. Is it possible?

like image 945
Gerardo Avatar asked Nov 14 '22 12:11

Gerardo


1 Answers

There is only one instance of the service, at most. You cannot have two instances. Hence, just have the second activity bind to the service ("recovery an instance").

like image 200
CommonsWare Avatar answered Dec 30 '22 16:12

CommonsWare