Android - How to receive the BOOT signal with an application installed on sdcard?

流过昼夜 提交于 2019-12-06 08:51:56

You could either:

  1. Register an account in the AccountManager and set up a sync service (tutorial1, tutorial2) -- Android will start your service automatically; or
  2. Listen for some other broadcasts as well (such as screen off / screen on) and test whether you need to start your notification service or not.

I realize these are not easy / convenient solutions, but they're the only ones I can think of. If anyone knows a better solution, I'll be happy to upvote :).

Another solution (which could eventually be used in conjunction with one of the above) is to start your service (or check if it needs to be started) when your application is launched from the application launcher (i.e. when the "main" activity is started).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!