Android - Alarm lost after app update

你说的曾经没有我的故事 提交于 2019-11-30 14:43:22

Your solution is as simple as below:

Have a broadcast receiver registered within your app with 2 intent filters namely:

  1. "android.intent.action.BOOT_COMPLETED" - called when you device restarts. Alarms are cancelled when device is shut down.
  2. "android.intent.action.MY_PACKAGE_REPLACED" - called once your app is reinstalled or updated from play store or from any source.

You will also need the permission, "android.permission.RECEIVE_BOOT_COMPLETED". In this receiver you can start your alarms again.

Yes you are correct. Once the app is updated the service, alarms and process of the app will be stopped. The updated apps will be in the stopped list of Andorid os.

Then only the alarm can be started once after the first manual launch of that application.

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