安卓中Notification传递参数

        Intent intent = new Intent(this, NotificationView.class);

        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);  
        intent.putExtra("notificationID", notificationID);
        intent.putExtra("name", "kitty");

        PendingIntent pendingIntent =PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);


需要设置Intent的flag为FLAG_ACTIVITY_CLEAR_TOP,PendingIntent.getActivity的第四个参数设置为PendingIntent.FLAG_UPDATE_CURRENT

你可能感兴趣的:(安卓中Notification传递参数)