Reputation: 1670
When application is in background and Firebase message received I want to open specific url that is in message data. For example i put below key-value in Firebase and i want to open google site after user tap on notification.
key: url
value: http://google.com
what should i do? tnx in advance!
Upvotes: 6
Views: 3876
Reputation: 12717
In your application you can access the key/value pairs sent from Advanced options > Custom data
in the Firebase Notification Web console in these ways:
getIntent().getExtras()
in the activity that is launched when the user tap the notification.onResume()
method.remoteMessage.getData()
in FirebaseMessagingService.onMessageReceived()
if the application is already open when the message arrives. (in this case the notification is not shown and instead the onMessageReceived()
is invoked.Upvotes: 3