• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dismissing Alarm when user uses Back or Home

 
James Henley
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!