Service stopped when the app removes from recent a

2019-08-26 02:15发布

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

2条回答
一夜七次
2楼-- · 2019-08-26 02:59

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.

查看更多
别忘想泡老子
3楼-- · 2019-08-26 03:02

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

查看更多
登录 后发表回答