android - Intent is losing values in extras -


i have gcmintentservice setting details intent , when user clicks on notification. code snippet relevant below:

notificationmanager notificationmanager = (notificationmanager) context.getsystemservice(context.notification_service); intent notificationintent = new intent(context, customtabactivity.class); if (noteid != null && value != null) {     notificationintent.putextra("noteid", noteid);     notificationintent.putextra("value", value); }  pendingintent contentintent = pendingintent.getactivity(context, 0, notificationintent, pendingintent.flag_update_current); notification updatecomplete = new notificationcompat.builder(context)         .setcontenttitle(title)         .setcontenttext(msg)         .setticker(title)         .setwhen(system.currenttimemillis())         .setcontentintent(contentintent)         .setdefaults(notification.default_sound)         .setautocancel(true)         .setsmallicon(r.drawable.icon)         .build();  notificationmanager.notify(100, updatecomplete); 

whenever customtabactivity.class opened, getextras() call null. why not able values intent?

i read following , not able solve it:

pass string 1 activity activity in android

android - how can send gcm push notification instructions of activity load?

i found bulk of problem here. turns out since had singletop activity, intent getintent() old one. code works:

protected void onnewintent(intent intent) {     super.onnewintent(intent);     if (intent.getextras() != null) {         string noteid = intent.getextras().getstring("noteid");         string value = intent.getextras().getstring("value");     } } 

onnewintent gets called when user clicks notification.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -