android - The notification doesn't appear? -
i have notification:
private void sendsimplenotification(){ boolean permanent = preferencemanager.getdefaultsharedpreferences(context).getboolean("permanent", false); if(permanent) { notificationcompat.builder notificationbuilder = new notificationcompat.builder(service.this); notificationbuilder.setcontenttitle("title"); notificationbuilder.setcontenttext("context"); notificationbuilder.setticker("tickertext"); notificationbuilder.setwhen(system.currenttimemillis()); notificationbuilder.setsmallicon(r.drawable.ic_stat_icon); intent notificationintent = new intent(this, service.class); pendingintent contentintent = pendingintent.getactivity(this, 0, notificationintent, 0); notificationbuilder.setcontentintent(contentintent); notificationbuilder.setdefaults(notification.default_sound | notification.default_lights | notification.default_vibrate); mnotificationmanager.notify(1, notificationbuilder.build()); } else{ mnotificationmanager.cancel(simple_notification_id); } }
my goal when checkboxpreferences checked notification appears, otherwise unchecked disappears.. goes wrong , notification doesn't appear/disappear when checkbox in preferences screen checked/unchecked. have call sendsimplenotification
somewhere? don't know error.
Comments
Post a Comment