How to open url post after firebase in background

When the application is in the background and a Firebase message is received, I want to open a specific URL that is in the message data. For example, I put below the key value in Firebase, and I want to open the google site after the user touches the notification.

key: url value: http://google.com 

what should I do? tnx in advance!

+5
source share
1 answer

In your application, you can access key / value pairs sent from Advanced options > Custom data in the Firebase notification web console in the following ways:

  • getIntent().getExtras() in an action that fires when the user getIntent().getExtras() notification.
    I recommend adding this to the onResume() method.
  • remoteMessage.getData() in FirebaseMessagingService.onMessageReceived() if the application is already open when a message arrives. (in this case, the notification is not displayed, and onMessageReceived() is called onMessageReceived() .
+3
source

All Articles