How to prevent android service getting killed (Service with notification)

前端 未结 4 1304
太阳男子
太阳男子 2021-01-22 23:15

I am working on an application which need to show notification constantly.
I\'ve a service to show the notification every seconds.
When the resources goes low android is

4条回答
  •  攒了一身酷
    2021-01-22 23:49

    As written above you need to use startForeground(int,Notification) method to aware user about your service. It also get more privilage for it.

    You can read more about it here (example inside).

提交回复
热议问题