Android Service Stops When App Is Closed

I’m in the same situation, so far I learned when the app is closed the service get closed also because they are in a one thread, so the service should be on another thread in order fot it not to be closed, look into that and look into keeping the service alive with alarm manager here an example http://www.vogella.com/articles/AndroidServices/article.html this way your service won’t be shown in notification.

lastly, after all the research I’ve done I’m coming to realize that the best choice for a long running service is startForeground(), because it is made for that and the system actually deals with your service well.

Leave a Comment