Android GCM通知活动未在第一次通知活动显示后的第二次通知中显示

Android GCM通知活动未在第一次通知活动显示后的第二次通知中显示,android,google-cloud-messaging,Android,Google Cloud Messaging,我在Android设备上实现了Android应用程序,我也收到了来自服务器的通知。但我面临的问题是,当接收活动为第一个通知数据打开时,当我收到第二个通知时,单击第二个通知时,它并没有用更新的通知数据替换接收活动。 请帮我做这个 正在使用以下代码:- private void sendNotification(String msg) { Log.d(TAG, "Preparing to send notification...: " + msg); mNotificationMan

我在Android设备上实现了Android应用程序,我也收到了来自服务器的通知。但我面临的问题是,当接收活动为第一个通知数据打开时,当我收到第二个通知时,单击第二个通知时,它并没有用更新的通知数据替换接收活动。 请帮我做这个

正在使用以下代码:-

private void sendNotification(String msg) {
    Log.d(TAG, "Preparing to send notification...: " + msg);
    mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
    Context context = getApplicationContext();

    //Notification notification = new Notification(icon, message, when); //UM
    Log.e(TAG, "Input Extra is...: " + msg);
    Intent notificationIntent = new Intent(context, ResultShowActivity.class);
    notificationIntent.putExtra("Message",msg);
    //notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP );

    int iUniqueId = (int) (System.currentTimeMillis() & 0xfffffff);
    int when= (int) System.currentTimeMillis() ;
    //PendingIntent contentIntent = PendingIntent.getActivity(this, iUniqueId,notificationIntent, 0);
    PendingIntent contentIntent = PendingIntent.getActivity(this, iUniqueId,notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT );
    Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
            this).setSmallIcon(R.drawable.gcm_cloud)
            .setContentTitle("GCM Notification")
            .setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
            .setAutoCancel(true)
            .setSound(alarmSound)
            .setContentText(msg);

    mBuilder.setContentIntent(contentIntent);
    //mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
    mNotificationManager.notify(when, mBuilder.build());
    Log.d(TAG, "Notification sent successfully.");
}

欢迎来到堆栈溢出!为了充分利用本网站,您可能需要更具体地说明您的问题。也许可以添加受影响的代码


但在你的情况下,问题似乎围绕着你的悬挂旗帜。添加以更新附加包,如果这是您想要做的。

以下是我用于挂起目的的代码:--