push notification - Android bundle from pending intent always recieved as null -


i tried suggested in stackoverflow - nothing helps. notification works fine, it's loses it's bundle somehow.

here pendingintent:

 notificationmanager notificationmanager = (notificationmanager)getsystemservice(context.notification_service);              intent intent = new intent(this, loginactivity.class);          //   intent intent = new intent().setclass(this, loginactivity.class);             intent.putextra(constants.key_bundle_message_from_notification,true);             intent.addflags(intent.flag_activity_new_task);             intent.addflags(intent.flag_activity_single_top);               //intent.setaction("dummy");              pendingintent contentintent = pendingintent.getactivity(this, 0, intent, pendingintent.flag_update_current);              notificationcompat.builder nobuilder = new notificationcompat.builder(this)                     .setsmallicon(r.mipmap.ic_launcher)                     .setcontenttitle(title)                     .setcontenttext(text) /*                    .setstyle(new notificationcompat.bigtextstyle()                             .bigtext(message))*/                     .setautocancel(true)                     .setcontentintent(contentintent);              notificationmanager.notify(0, nobuilder.build()); 

1) adding action intent: intent.setaction("dummy");

2) adding setclass intent: .setclass(this, loginactivity.class);

3) pending intent tried flags: pendingintent.flag_update_current / flag_cancel_current / flag_one_shot/ 0

4) tried recieving extras in both "onnewintent" , in "oncreate"

the extras in recieving activity false

 @override     protected void onnewintent(intent intent) {         super.onnewintent(intent);         log.d(tag, "im in login notification!   "+ intent.hasextra(constants.key_bundle_message_from_notification));     }   @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_login);      intent intent = getintent();     log.d(tag, "im in login notification!   "+ intent.hasextra(constants.key_bundle_message_from_notification)); 

}

any ideas? thanks!

in onnewintent add : setintent(intent)


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -