Persistent service

后端 未结 2 801
轮回少年
轮回少年 2020-12-14 02:51

I know that some peoples view is that you should not create persistent services.

But for those of us that want to increase our knowledge, how does one go about crea

2条回答
  •  粉色の甜心
    2020-12-14 03:30

    You can only make your service persistent if you are developing system apps. These services will be basically un-killable, and are labeled as "PERS" in the output of the "adb shell dumpsys activity" command. It's not very well documented, so I did a quick write-up on Persistent services in Android...hopefully it will help some people out.

    But for non-system apps, startForeground is your best option.

提交回复
热议问题