Android actions example not working as expected
Issue
Following the tutorial of Android Actions - Adding a custom button will not give proper results when action is clicked. NotificationOpen.action is not test_action, instead it has value android.intent.action.VIEW
Note: onNewIntent() in MainActivity does contain proper action for Intent.
Environment
- Application Target Platform:
Both
- Development Operating System:
macOS Sierra
- Build Tools:
Android Studio 3.1.3
React Nativeversion:
0.54.0
React Native FirebaseVersion:
^4.3.0
FirebaseModule:
Notifications
- Are you using
typescript?
No
I am facing the same issue.
const action=new Firebase.notifications.Android.Action('like','ic_launcher','like') action.setShowUserInterface(true); notification.android.addAction(action);
With the above code, I am able to add an action button to the android push notification but on clicking on a notification when the app is in the background, NotificationOpen.action is not 'like', instead it has value android.intent.action.VIEW
@Ehesp , Please help me with this issue.
@NirpE , Did you figure out the solution for the problem
Could either of you give me a reproducible repo - it would help me debug this quicker.
Unfortunately, I cannot provide any reproducible repo. However I followed the same instructions as per the documentation.
`// 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 literally followed the above snippet from the firebase documentation. However, when I click on the button, notificationOpen.action does not give me "test_action". Instead I get "android.intent.action.VIEW" as the action. This is not letting me to differentiate the button click with the notification click.
Hello 👋, this issue has been automatically marked as stale because it has not had activity for quite some time. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.
Hello 👋, this issue has been automatically marked as stale because it has not had activity for quite some time. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.
same problem Any updates ? ps : I am using react native navigation v1