posted 9 years ago
I am building an alarm app and have run into a problem I can't seem to find the answer to. Here is the problem... Everything works as expected except when a user uses the Back or Home button while the alarm is playing. The dismiss Alarm dialog closes but the alarm keeps playing with no way to stop it other than forcing the program to close in Settings. I have tried stopping the mediaplayer in the onPause and onStop methods. This causes proper behavior if the device is awake, but if asleep it prevents the alarm from playing at all when woken up. If the device is asleep, the alarm dialog pops up, but the alarm makes a brief noise and stops.
I am sooooo close to getting this working right and I'm thinking that there is something simple I'm overlooking. I have searched for days high and low on the Internet and cannot come up with anything that helps.
Here is the AlarmScreen activity