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!
Firebase notifications behave differently depending on the foreground/background state of the receiving app. If you want foregrounded apps to receive notification messages or data messages, you'll need to write code to handle the onMessageReceived callback.
Open the Cloud Messaging tab of the Firebase console Settings pane and scroll to the Web configuration section. In the Web Push certificates tab, find and select the link text, "import an existing key pair."
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.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With