I want to develop push notifications which has custom action buttons (2 buttons) which says "Yes" & "No" clicking on "Yes" button calls an REST Api without actually opening the app.
The notification should work irrespective of whether the app is in foreground or background.
I am currently using firebase for showing PushNotification specific react-native-firebase v5.
Have tried "android actions" from react native firebase, but unable to get action button on push notification.
// 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);
I want it in PushNotification not as an local notification.
Please help.
Thanks in advance.