I have Some Alarms set via AlarmManager to do some periodic jobs. I set/reset them when user opens the app for the first time & on every boot_complete event. But when the app is reinstalled via ADB then my alarms do not fire anymore. looks like the OS deletes the Alarms on reinstall of the app. I assume this will happen if the user updates the app from the market also.
If I can receive a broadcast or some sort of callback in the event of reinstall/upgrade etc of my application, I can set the alarms again. but i don't know if it is possible or how? Can someone please help me out.
Yes, this is possible.
You can create a broadcast receiver that listens for any PACKAGE_*
events the system sends, but you won't receive them for your own application except for when your application is being upgraded — you'll get PACKAGE_REMOVED
followed soon after by PACKAGE_REPLACED
.
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