Android: get an instance from a service running

I have a service running in the background. I started it with Activity, but I want to restore an instance of this service from another action (in the same application) in order to call one method. Is it possible?

+4
source share
1 answer

There is only one service instance, maximum. You cannot have two copies. Therefore, simply attach the second action to the service (โ€œrestore instanceโ€).

+1
source

Source: https://habr.com/ru/post/1301499/


All Articles