我已经为actionbuttons click事件设置了广播接收器,并在FirebaseMessagingService的oncreate()方法中注册了该接收器,并在ondestroy()方法中取消了该接收器的注册,因此这些Action Buttons Click事件不起作用。此问题仅在比oreo更低的android版本中发生
public void onCreate() {
super.onCreate();
// create the notification action button listener
notificationButtonClickReceiver = new NotificationButtonClickReceiver();
// add actions for the receiver
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(action1);
intentFilter.addAction(action2);
registerReceiver(notificationButtonClickReceiver, intentFilter);
}
@Override
public void onDestroy() {
super.onDestroy(); unregisterReceiver(notificationButtonClickReceiver);
}