问题
In my application I am using service to run background services continuously even the app removes from recent apps list. But the service stopped if I remove the app from recent apps list. Can any one gives me the solution?
Thanks, Sekhar
回答1:
you have to make and show a notification until your service is running, use below code :
startForeground(id, notify.build());
for more information check example project in here . or maybe your problem is like that .
good luck.
回答2:
Start service by returning START_REDELIVER_INTENT
onStartCommand of service to continuously run your service see my answer here.
And if you never have worked on service before then i suggest you to read Service documentation first so you will get more idea and clarification : refer this doc
来源:https://stackoverflow.com/questions/34104525/service-stopped-when-the-app-removes-from-recent-apps-list-in-android