Search code examples
androidandroid-intentbundleextras

android: getting same value from Intent extras


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?


Solution

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