My application notifications should appear even when the phone is silent. This is a prayer app and, for example, the notification needs to sound when it comes to prayer even if the phone is in silent mode at night, which can sometimes be long (eg: like adhan).
I used the MediaPlayer library for this and I can play sound in a healthy way, even if my application is closed (this is what it should be). However, when you click on the notification or swipe left or right, this playing mediaplayer should stop, but it doesn't. I set the background service and tried to check it there but couldn't catch the notification swiping left or right, it still won't stop.
When I add an action with PendingIntent for the notification (I add it as builderNotify.addAction (R.drawable.notify_icon, "Stop", actionIntent);) and this time when I click this action it just stops, but then it returns an error in the background.
Can you help me?
Edit: I managed to stop it when the notification was swiped right or left. However, when the user clicks on the notification and enters the application, the mediaplayer continues to play.