Skip to content Skip to sidebar Skip to footer

Pass Url To Webview Android From Firebase Push Notification

I am able to send push notification to and app with key value pair. How to give the value as URL and when the user clicks on the notification received, it must navigate to a webvie

Solution 1:

Create intent to your Activity with webview

intent = newIntent(getApplicationContext(), WebViewActivity.class);
    intent.putExtra("url", your_url_from_data);

Create Content intent

contentIntent = PendingIntent.getActivity(this, getNotificationID(), intent ,PendingIntent.FLAG_ONE_SHOT);

setContentIntent(contentIntent) in notification builder

Then in WebViewActivity.class just receive url from bundle and load to webview as webView.loadUrl(url)

Post a Comment for "Pass Url To Webview Android From Firebase Push Notification"