If you are changing the extra data, you want to use PendingIntent.FLAG_CANCEL_CURRENT.
On Sep 29, 9:30 am, Gil <[EMAIL PROTECTED]> wrote: > My app uses the status bar to handle notifications. It also sets an > extra string in the intent when a notification is generated. Consider > the following sequence of events: > > 1) First notification is generated. User clicks on the notification. > An activity of my app receives the intent looks at the extra string. > The app gets what it expects in the extra string. > 2) The second notification is received. User clicks on the > notification. My activity receives the intent but the extra string > (which is different this time) is the extra string from the first > notification. > > Here is the code I use each time I generate a notification: > 1) I create the notification intent at startup: > > m_clickIntent = new Intent( Intent.ACTION_MAIN); > m_clickIntent.setClass( m_context, MyActivity.class); > m_clickIntent.setFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP | > Intent.FLAG_ACTIVITY_NEW_TASK); > > 2) I generate the first notification: > > m_clickIntent.putExtra( "data", "first hello"); > m_currentNotification = new > Notification( R.drawable.status_bar_message_image, "Test", > System.currentTimeMillis()); > m_currentNotification.setLatestEventInfo( m_context, > m_context.getResources().getString( R.string.app_name), "Test", > PendingIntent.getActivity( m_context, 0, m_clickIntent, 0)); > m_notificationManager.notify( APP_NOTIFICATIONS, > m_currentNotification); > > 3) I generate the second notification: > m_clickIntent.putExtra( "data", "second hello"); > ... same code as for the first notification > > I tried allocating the intent each time I generate the notification > but that makes no difference. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---