android - Notification addAction creates button with no behavior -



android - Notification addAction creates button with no behavior -

i trying add together button notification in android. utilize addaction method in order add together intent supposes open main activity (same clicking entire notification) bundle data. have done far:

notificationmanager = (notificationmanager)this.getsystemservice(notification_service); //regular intent view main activity pendingintent contentintent = pendingintent.getactivity(this,constants.main_activity, new intent(this, mainactivity.class), 0); //intent viewing transaction dialog, within main activity using purchase_dialog request code bundle bundle = new bundle(); bundle.putparcelablearraylist(constants.list, (java.util.arraylist<? extends android.os.parcelable>) list); pendingintent purchaseintent = pendingintent.getactivity( this, constants.purchase_dialog, new intent(this, mainactivity.class), 0, bundle); notificationcompat.builder mbuilder = new notificationcompat.builder(this) .setsmallicon(r.drawable.ic_launcher) .setcontenttitle(constants.notification_topic) .setstyle(new notificationcompat.bigtextstyle() .bigtext(watchresponse.tostring())) .setautocancel(true) .addaction(r.drawable.ic_launcher, "buy", purchaseintent) .setcontenttext(message); mbuilder.setcontentintent(contentintent); notificationmanager.notify(notification_id, mbuilder.build());

i expect onresume in mainactivity class called 1 time clicking action, , there i'll able bundle trough getintent(), yet nil happens when click on it. button clicked, activity remains open , application activity wont start.

i had similar issue different solution. pending intent not fired if have declared <service android:enabled="false"></service> in manifest.xml file.

replace android:enabled="false" android:enabled="true"

this might not direct issue of problem. if create service in android studio using default template automatically adds these properties service.

if not work there similar question can find here: android notification action not fired (pendingintent)

android android-intent android-notifications

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -