Android通知欄Notificationクリックジャンプ無効

831 ワード

必ず保証しなければならない
notificationManager.notify(0,builder.build());

このコードはsetContentIntent()メソッドの後に書くのは無効です.
前に無効なコードをクリックしたのは、このように書かれています---->間違った方法です.
notificationManager.notify(0,builder.build());
//            
        Intent intent = new Intent(this,ChatActivity.class);
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
        builder.setContentIntent(pendingIntent);

修正後----->正しい方然:
//            
        Intent intent = new Intent(this,ChatActivity.class);
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
        builder.setContentIntent(pendingIntent);
notificationManager.notify(0,builder.build());