React native 推送通知中的自定义操作按钮

React native 推送通知中的自定义操作按钮,react-native,push-notification,react-native-android,android-push-notification,React Native,Push Notification,React Native Android,Android Push Notification,我想开发具有自定义操作按钮(2个按钮)的推送通知,该按钮显示“是”和“否”,单击“是”按钮调用REST Api而不实际打开应用程序 无论应用程序是在前台还是后台,通知都应该有效 我目前正在使用firebase显示特定于PushNotification的react本机firebase v5 已尝试使用react native firebase的“android操作”,但无法在推送通知上获取操作按钮 // Set up your listener firebase.notifications

我想开发具有自定义操作按钮(2个按钮)的推送通知,该按钮显示“是”和“否”,单击“是”按钮调用REST Api而不实际打开应用程序

无论应用程序是在前台还是后台,通知都应该有效

我目前正在使用firebase显示特定于PushNotification的react本机firebase v5

已尝试使用react native firebase的“android操作”,但无法在推送通知上获取操作按钮

    // Set up your listener
firebase.notifications().onNotificationOpened((notificationOpen) => {
    // notificationOpen.action will equal 'test_action'
});

// Build your notification
const notification = new firebase.notifications.Notification()
  .setTitle('Android Notification Actions')
  .setBody('Action Body')
  .setNotificationId('notification-action')
  .setSound('default')
  .android.setChannelId('notification-action')
  .android.setPriority(firebase.notifications.Android.Priority.Max);
// Build an action
const action = new firebase.notifications.Android.Action('test_action', 'ic_launcher', 'My Test Action');
// Add the action to the notification
notification.android.addAction(action);

// Display the notification
firebase.notifications().displayNotification(notification);
我希望它在PushNotification中,而不是作为本地通知

请帮忙


提前谢谢。

您好,您是如何修复的?我必须整合完全相同的工作。检查此链接