Android: Detect status bar notification click -


when application fires notification want method called after user clicks notification

this's how create notification :

    intent alarmintent = new intent(mainactivity.this, alarmreceiver.class);     alarmintent.setflags(intent.flag_activity_clear_top | intent.flag_activity_single_top);      bundle bundle = new bundle();     pendingintent pendingintent;     alarmmanager manager = (alarmmanager) getsystemservice(context.alarm_service);      date date = new date();      bundle.putstring("name", "name");     bundle.putstring("body", "body");     alarmintent.putextras(bundle);      pendingintent = pendingintent.getbroadcast(mainactivity.this, 10000, alarmintent, pendingintent.flag_cancel_current);     manager.setexact(alarmmanager.rtc_wakeup, date.gettime()+5000, pendingintent); // fire after 5 seconds of launch 

so how edit code achieve .. thank you

try code notification

for calling

    notificationshow(this); 

method definition

    notificationshow(context c) {         /*********** create notification ***********/         intent intent = new intent(this, act_run_ifclicknotifctn.class);         pendingintent pintent = pendingintent.getactivity(this, 0, intent, 0);         notification n = new notification.builder(this)             .setcontenttitle("new notification text title")             .setcontenttext("new content text")             .setsmallicon(r.drawable.ic_launcher)             .setcontentintent(pintent)             .setautocancel(true)             /*.addaction(r.drawable.ic_launcher, "call", pintent)             .addaction(r.drawable.ic_launcher, "more", pintent)             .addaction(r.drawable.ic_launcher, "and more", pintent)*/             .build();          notificationmanager notimgr = (notificationmanager)             .getsystemservice(notification_service);          notimgr.notify(0, n);     } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -