如何在WebView中打开OneSignal通知

时间:2017-06-10 21:32:13

标签: android webview

通知在浏览器中打开,我想打开webview。 如何在WebView中打开OneSignal通知,谢谢

以下是MainActivity中的代码

.java class

OneSignal.startInit(this).setNotificationOpenedHandler(new OneSignal.NotificationOpenedHandler() { @Override public void notificationOpened(OSNotificationOpenResult result) { String launchURL = result.notification.payload.launchURL; if (launchURL != null) { // Log.d(Const.DEBUG, "Launch URL: " + launchURL); Intent intent = new Intent(getApplicationContext(), MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("url", launchURL); startActivity(intent); } else { // Log.d(Const.DEBUG, "Launch URL not found"); Intent intent = new Intent(getApplicationContext(), MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } } }).init();

0 个答案:

没有答案