Android Service Stops When App Is Closed -
i starting service main android activity follows:
final context context = base.getapplicationcontext(); final intent intent = new intent(context, myservice.class); startservice(intent); when close activity page swiping out recent apps list, service stops running , restarts after time. can't use persistent services notifications because of app requirements. how can make service not restart or shutdown , keep on running on app exit?
i'm in same situation, far learned when app closed service closed because in 1 thread, service should on thread in order fot not closed, , keeping service alive alarm manager here example http://www.vogella.com/articles/androidservices/article.html way service won't shown in notification.
lastly, after research i've done i'm coming realize best choice long running service startforeground(), because made , system deals service well.
Comments
Post a Comment