0

I send from a Service a notification which contents Parcelable ArrayList.

//my service code
Intent intent = new Intent(mContext, AutoSearchActivity.class);

//In this list, there is 3 elements
intent.putParcelableArrayListExtra(Staff.JSON_ARRAY,staffs);

PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, intent , 0);

Notification notification = new Notification(
    R.drawable.toplogo, 
    (String) getResources().getString(R.string.notification),
    System.currentTimeMillis());

String titleNotification = (String) getResources().getString(R.string.notification_title);

String textNotification = (String) getResources().getString(R.string.notification_content);

notification.setLatestEventInfo(mContext, titleNotification,textNotification, pendingIntent);

notification.vibrate = new long[] { 0, 400, 100, 400, 100, 600 };

notificationManager.notify(ID_NOTIFICATION, notification);

After cliking on my notification, AutoSearchActivity is executed. I try to catch data and display them, but only old data are displayed. I guess there is a kind of cache system, but I don't know how to delete it.

//in my AutoSearchActivity
Bundle bundle = getIntent().getExtras();

//only 1 element !!!
ArrayList<SiteStaff> listAppInfo = bundle.getParcelableArrayList(Staff.JSON_ARRAY);

Thank you for your help !

johann
  • 1,115
  • 8
  • 34
  • 60

1 Answers1

4

Yup , Pending Intent is cached, creates a lot of problems. Change your line to PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, intent , PendingIntent.FLAG_UPDATE_CURRENT); to force the Pending intent to take the only latest value even if it is fired multiple times.

Akhil
  • 13,888
  • 7
  • 35
  • 39
  • 1
    Thank you my friend ~ It works ! First time i heard about Pending intent problem ~ thanks ! – johann Mar 27 '12 at 09:54