Android Notification Action is not fired (PendingIntent)

前端 未结 9 1639
盖世英雄少女心
盖世英雄少女心 2020-12-30 02:39

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

9条回答
  •  南笙
    南笙 (楼主)
    2020-12-30 02:59

    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.

提交回复
热议问题