I am trying to add an Notification action item in my app which is a music player. When a stream is started a notification should be triggered and an stop button for the stre
You do not receive the broadcast when it is in the background because you are unregistering in onPause. Move the unregisterReceiver code to onDestroy function. This will be called only when the activity is destroyed. Or you can unregister once the expected event has occurred.