Notification de passe ancien Intention Extras

je suis de la création d'une notification à l'intérieur d'un BroadcastReceiver par l'intermédiaire de ce code:

String ns = Context.NOTIFICATION_SERVICE;
        NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(ns);
        int icon = R.drawable.ic_stat_notification;
        CharSequence tickerText = "New Notification";
        long when = System.currentTimeMillis();

        Notification notification = new Notification(icon, tickerText, when);
        notification.defaults |= Notification.DEFAULT_VIBRATE;
        long[] vibrate = {0,100,200,200,200,200};
        notification.vibrate = vibrate;
        notification.flags |= Notification.FLAG_AUTO_CANCEL;

        CharSequence contentTitle = "Title";
        CharSequence contentText = "Text";
        Intent notificationIntent = new Intent(context, NotificationActivity.class);
        notificationIntent.putExtra(Global.INTENT_EXTRA_FOO_ID, foo_id);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);

        notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);

        int mynotification_id = 1;

        mNotificationManager.notify(mynotification_id, notification);

Quand je clique sur la notification, il ouvre le NotificationActivity et à l'intérieur de l'Activité, je peux récupérer le foo_id de l'Intention de l'-Bundle (par exemple: 1)

Toutefois, si un autre notification est déclenchée et que je clique sur nouveau, l'activité reçoit encore les "vieux" de la valeur (1) de l'Intention de l'-Bundle. J'ai essayé d'effacer le bundle avec clear(), mais je reçois le même effet. Je pense que qqch est le problème avec mon code..

  • s'il vous plaît pouvez-vous me dire comment obtenir les données de l'attente de l'intention
  • pour réaliser que c'était l'envoi de vieux extras, fait mon tri plus facile.
InformationsquelleAutor BrianM | 2011-09-10