0

I am doing this to create a Intent.

Intent notificationIntent = new Intent(this, Startup.class);
notificationIntent.putExtra("url", contentUrl);

PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
Notification notification = new Notification(icon, tickerText, when);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);

On getting the extra,

CharSequence url = this.getIntent().getCharSequenceExtra("url");

There are many Intents with their respective url values. But I also get back the same value inside onCreate() of Startup class.

What did I do wrong?

anewbie
  • 13
  • 1
  • 4

2 Answers2

5

This should answer you query for sure...cheers :) Android keeps caching my intents Extras, how to declare a pending intent that keeps fresh extras?

Community
  • 1
  • 1
Nitin
  • 1,451
  • 13
  • 17
  • This works! notificationIntent.setAction("actionstring" + System.currentTimeMillis()); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); – anewbie Jun 20 '11 at 01:23
0

Use this

PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notifyIntent, android.content.Intent.FLAG_ACTIVITY_NEW_TASK);

instead of this

PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

and check the results

success_anil
  • 3,659
  • 3
  • 27
  • 31