Get local notification while app is forced closed in android -
in facebook android app notifications while app forced closed. works because there push notification implemented. have implemented local notification in app , want app notify if app forced closed. how can implement it.
void shownotify() { charsequence details = "notification raised"; int reqcode=0; intent notificationintent = new intent(context, notifylistactivity.class); // notificationintent.putextra("clicked", "notification clicked"); notificationintent.addflags(intent.flag_activity_new_task | intent.flag_activity_single_top); // open 1 activity // on launch. pendingintent pintent = pendingintent.getactivity(context, reqcode, notificationintent, pendingintent.flag_update_current); notificationmanager nm = (notificationmanager) context .getsystemservice(context.notification_service); notificationcompat.builder notify = new notificationcompat.builder( context); notify.setcontentintent(pintent); notify.setsmallicon(r.drawable.appicon); notify.setcontenttitle(""); notify.setcontenttext(details); notify.setautocancel(true); nm.notify(reqcode, notify.build()); screenon(context); }
i dont think should control if app force closed, imo normal not behave expected if app has been force closed.
having said these 2 things different, when receive push notification receiving message internet (or other source) , can respond message showing local notification (in notification bar), nedd way trigger local notification in order shown (a repeating alarm?), notifications cannot launched (or @ least not know how it).
Comments
Post a Comment