Can't stop the ringing alarm from another activity
Solution 1:
Your architecture is broken. You don't use a BroadcastReceiver
for persistent processing. A BroadcastReceiver
has a very short lifecycle, you use it to trigger other things.
You've created a MediaPlayer
instance in your BroadcastReceiver
and are trying to control that in onReceive()
. This is wrong. You should use a Service
to manage and maintain the state of your MediaPlayer
.
See if you can find some HOWTO guides on the Internet for how to build such an application.