notifications - Android AlarmManager putExtra to PendingIntent and NotificationCompat.Builder -
i'm trying putextra activity launched after clicking on notification, instead of value set i'm getting default value. code in alarmreceiver:
intent notifactiv = new intent(context, notificationactivity.class); notifactiv.putextra("id", id); pendingintent pi = pendingintent.getactivity(context, 0, notifactiv, 0); notificationcompat.builder mbuilder = new notificationcompat.builder( context).setsmallicon(r.drawable.ic_launcher) .setcontenttitle(string).setticker("you got meeting today!") .setcontenttext("click here more details"); mbuilder.setcontentintent(pi); mbuilder.setdefaults(notificationcompat.default_vibrate); mbuilder.setautocancel(true); notificationmanager notificationmanager = (notificationmanager) context .getsystemservice(context.notification_service); notificationmanager.notify(1, mbuilder.build()); and notificationactivity i'm trying extras:
intent intent = getintent(); int id = intent.getintextra("id", 0); could please tell i'm doing wrong?
Comments
Post a Comment