android - Cannot Send data Through pendingIntent -



android - Cannot Send data Through pendingIntent -

i trying set notification using pendingintent.but cant recieve info sent.

these codes

class displaying notification(working can every info intent)

protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //---get notification id notification; // passed in mainactivity--- int notifid = getintent().getextras().getint("id"); string date = getintent().getextras().getstring("date"); string time = getintent().getextras().getstring("time"); string text = getintent().getextras().getstring("text"); //---pendingintent launch activity if user selects // notification--- notificationmanager nm = (notificationmanager) getsystemservice(notification_service); notification notif = new notification( r.drawable.ic_launcher, text +" "+date+" @ "+time, system.currenttimemillis()); notif.flags = notification.flag_auto_cancel; charsequence = "todo note"; charsequence message = text; intent p = new intent(this,notifthrow.class); p.putextra("id",notifid); p.putextra("date",date); pendingintent detailsintent = pendingintent.getactivity(this, 0, p, 0); notif.setlatesteventinfo(this, from, message, detailsintent); //---100ms delay, vibrate 250ms, pause 100 ms , // vibrate 500ms--- notif.vibrate = new long[] { 100, 250, 100, 500}; nm.notify(notifid, notif); //---destroy activity--- finish(); } }

this class (below) should work when touch on notification(it works no info intent)

public class notifthrow extends activity { tododatasource datasource; sqlitedatabase database; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); int notifid = getintent().getextras().getint("id"); string dates = getintent().getextras().getstring("date"); log.i("message notification touch","id"+notifid); datasource = new tododatasource(this); datasource.alarmtoggle(notifid); intent intent = new intent(this,mainactivity.class); intent.addflags(intent.flag_activity_clear_top); intent.addflags(intent.flag_activity_no_animation); startactivity(intent); }

id ,date showing null

what doing wrong here ? in advance..

did workaround

set public static int id within class notifthrow.java , updated outside

android android-pendingintent

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -