Android - Alarm Lost After App Update
I have an app running on Android that creates an alarm that is fired every 24 hours. This alarm is working as expected. However, when I update my app through Google Play this alarm
Solution 1:
Your solution is as simple as below:
Have a broadcast receiver registered within your app with 2 intent filters namely:
- "android.intent.action.BOOT_COMPLETED" - called when you device restarts. Alarms are cancelled when device is shut down.
- "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.
Solution 2:
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.
Post a Comment for "Android - Alarm Lost After App Update"