Im working on an app that uses AlarmManager
for some processes. I wanted to ask that if i update my app on the playstore. (update not new install) will registered alarms get canceled? Also will values of SharedPreference
get reset?
Alarms: Yes, they will get canceled but you can restart your alarms.
Here is the solution from this post https://stackoverflow.com/a/34464059/3474021
Have a broadcast receiver registered within your app with 2 intent filters namely:
android.intent.action.BOOT_COMPLETED
(docs) - called when your device restarts. Alarms are cancelled when device is shut down.android.intent.action.MY_PACKAGE_REPLACED
(docs) - 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
to receive android.intent.action.BOOT_COMPLETED
. In this receiver you can start your alarms again.
SharedPreferences: No, they will remain when an app is updated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With