E
E
Evgeny Petrov2019-08-21 09:35:01
Java
Evgeny Petrov, 2019-08-21 09:35:01

Why does the service restart when the Activity is closed?

Good afternoon.
I observe an interesting picture: I have a service that works in the background. Runs once and works there without completion (essentially listens to Firebase and saves to SharedPrefs if there is a change). Now, if the Activity is terminated, the running service is restarted for some reason (onStartCommand() fires). Of course, while this does not create problems, but in my opinion this is not a very good practice. How to be in this situation? Thanks in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question