Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我想在我的webview android中的对话框或消息框中显示Firebase消息_Android_Firebase_Firebase Cloud Messaging - Fatal编程技术网

我想在我的webview android中的对话框或消息框中显示Firebase消息

我想在我的webview android中的对话框或消息框中显示Firebase消息,android,firebase,firebase-cloud-messaging,Android,Firebase,Firebase Cloud Messaging,我想在我的webview android中显示google firebase通知。当前 我收到的消息没有任何问题,但当我点击通知,它会带我到我的网络视图 单击“通知”时所需的信息应显示在“我的web视图”的对话框中的“我的web视图”中。 到目前为止,我已经实现了firebase通知和接收消息,没有任何问题 到目前为止,我所做的工作如下 FCMMessageReceiverService.java文件 public class FCMMessageReceiverService extends

我想在我的webview android中显示google firebase通知。当前 我收到的消息没有任何问题,但当我点击通知,它会带我到我的网络视图

单击“通知”时所需的信息应显示在“我的web视图”的对话框中的“我的web视图”中。 到目前为止,我已经实现了firebase通知和接收消息,没有任何问题

到目前为止,我所做的工作如下

FCMMessageReceiverService.java文件

public class FCMMessageReceiverService extends FirebaseMessagingService{
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {

    Log.w("fcm", "received notification");
    sendNotification(remoteMessage.getNotification().getTitle());

}

private void sendNotification(String messageBody) {
    Intent intent = new Intent(this, FullscreenActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 , intent,
            PendingIntent.FLAG_ONE_SHOT);

    Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.mipmap.ic_launcher)
            .setContentTitle(messageBody)
            .setAutoCancel(false)
            .setSound(defaultSoundUri).setContentInfo(messageBody);

    NotificationManager notificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    notificationManager.notify(1, notificationBuilder.build());
}
}
和fullscreenactivity.java文件

  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    /*firebase get token start*/
    String token = FirebaseInstanceId.getInstance().getToken();
    if (token != null) {
        Log.w("notification", token);
    }
    /*firebase get token end*/

    setContentView(R.layout.activity_fullscreen);

    WebView view=(WebView) this.findViewById(R.id.webView);
    progressBar = (ProgressBar) findViewById(R.id.progressBar1);

    view.getSettings().setSupportMultipleWindows(true);
    view.getSettings().setJavaScriptEnabled(true);
    view.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);

    //view.setWebChromeClient(new WebChromeClient());
    //view.setWebViewClient(new WebViewClient());

    view.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            // TODO Auto-generated method stub
            super.onPageStarted(view, url, favicon);
            findViewById(R.id.progressBar1).setVisibility(View.VISIBLE);
        }

       @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            // TODO Auto-generated method stub
            super.onPageFinished(view, url);
            findViewById(R.id.progressBar1).setVisibility(View.GONE);
            progressBar.setVisibility(View.GONE);
        }

    });
    view.loadUrl("http://example.com");

    mVisible = true;
    mControlsView = findViewById(R.id.fullscreen_content_controls);
    mContentView = findViewById(R.id.fullscreen_content);


    // Set up the user interaction to manually show or hide the system UI.
    mContentView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            toggle();
        }
    });

    // Upon interacting with UI controls, delay any scheduled hide()
    // operations to prevent the jarring behavior of controls going away
    // while interacting with the UI.
    FirebaseCrash.report(new Exception("App Crash Reports:Crash errors"));
}

你解决了吗?你解决了吗?