I send here such data
{ 'title' : "title", 'body' : "http://google.com", } "data" : { "url" : "http://google.com" } I try to do this:
Intent resultIntent = new Intent(Intent.ACTION_VIEW); resultIntent.setData(Uri.parse( remoteMessage.getData().get("url") )); Log.e("msg", remoteMessage.getData().get("url")); PendingIntent pending = PendingIntent.getActivity(this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(pending); URL is parsed in D / MainActivity: Key: url Value: http://google.com
but when you click on the notification program opens
This is essentially the entire program code:
@Override public void onMessageReceived(RemoteMessage remoteMessage) { Uri sound= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder builder = new NotificationCompat.Builder(this); builder.setSound(sound); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); // pending implicit intent to view url Intent resultIntent = new Intent(Intent.ACTION_VIEW); resultIntent.setData(Uri.parse( remoteMessage.getData().get("url") )); Log.e("msg", remoteMessage.getData().get("url")); PendingIntent pending = PendingIntent.getActivity(this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(pending); notificationManager.notify(0, builder.build()); }