Reputation: 5597
I'm adding alarms via AlarmManager
.
Checking with this command if the alarm exist:
adb shell dumpsys alarm
After setting the alarm (repeating alarm setRepeating()
), if I close the app via back button or close via task manager, the alarm is still there in the log.
But when I re-run the app (shift f10) from Android studio the alarm is not there anymore!
What am I missing?
Upvotes: 3
Views: 256
Reputation: 163
When you re-run you app with Shift+F10 means that Andriod Studio make "Force Stop" for your application. If your application is force stopped then you application will never receive any of alarms because process of your application is not placed inside memory of phone. No process = no alarms. It's awful but it is reality :(
Upvotes: 0
Reputation: 858
When you re-run the app the Android studio installs the app, so you'll lose the Alarm.
The repeat alarm cancels when cancel(OnAlarmListener) is called which I guess happens when updating/re-install the app.
You may find this StackOverflow's answer useful.
Consider other ways to apply the app changes as an alternative.
Upvotes: 0