android - can not read extra from intent when app startup from notification -
i using fcm receive messages , on onmessagereceived have code
notificationmanager notificationmanager = (notificationmanager) getapplicationcontext().getsystemservice(service.notification_service); intent notifyintent = new intent(this,hellobubblesactivity.class); notifyintent.putextra("id",sender); notifyintent.addflags(intent.flag_activity_new_task | intent.flag_activity_single_top); pendingintent pendingintent = pendingintent.getactivity(getapplicationcontext(), 0, notifyintent, pendingintent.flag_cancel_current); notificationcompat.builder mbuilder = new notificationcompat.builder(this) .setcontenttitle("new message " + name) .setsmallicon(r.drawable.smalllogo) .setautocancel(false) .setcontenttext(text) .setcontentintent(pendingintent); notificationmanager.notify(sender, mbuilder.build());
when app opening notification have problem getting -1 code here
int chatid = getintent().getintextra("id",-1);
did miss thing ?
insure activity not singleinstance enable. time problème singleinstance activity
Comments
Post a Comment