Closed aruphazarika closed 6 years ago
Hey @aruphazarika , you can check out the tutorial where I add actions to the notification: https://www.pluralsight.com/guides/push-notifications-with-firebase-cloud-messaging
I have tested your above project, I didnot get what I was looking for, I want when users clicks on notification , then the app will open a specific activity which was send in JSON , It will be more fine if Notification buttons have specific click action activity. Thank you!
I have both of those cases implemented in the tutorial. If you want clicking on the activity to open a specific activity you create a pending intent and pass it to the NotificationBuilder.setContentIntent(), as shown here: https://www.pluralsight.com/guides/push-notifications-with-firebase-cloud-messaging#module-customizingnotifications
If you want to add buttons to the notification that do certain operations on the background you create a service, otherwise you can still create a pending intent and pass it to NotificationBuilder.addAction(). The notification payload can be passed with intent extras to the activity or service, as demonstrated here: https://www.pluralsight.com/guides/push-notifications-with-firebase-cloud-messaging#module-notificationbuttons
Hope that was exhaustive enough.
Thanks for replying, I m beginner in this field, can u pls write code in your project as demo
Suppose I have Activity1, Activity2, I want to open Activity2 after clicking notification, what is code for that?
How to add Click action in this, pls help