android - NotificationCompat.Builder -


i send in constructor of class extends nothing context

int icon = r.drawable.ic_launcher;         long when = system.currenttimemillis();         mynotification = new notificationcompat.builder(context)                 .setsmallicon(icon)                 .setcontenttitle(context.getresources().getstring(r.string.app_name))                 .setcontenttext(context.getresources().getstring(r.string.app_name))                 .setwhen(when)                 .setticker(context.getresources().getstring(r.string.app_name))                 .setdefaults(notification.flag_no_clear); 

and send datas through remoteviews , on end

intent notificationintent = new intent(context, menu_activity.class); pendingintent contentintent = pendingintent.getactivity(context, 0, notificationintent, 0); contentview.setonclickpendingintent(r.id.layoutnotification, contentintent); mynotification.setcontent(remoteview);  mynotification.setongoing(false); mynotification.setautocancel(false);  mynotification.setpriority(notification.priority_high); mynotification.setcontentintent(contentintent);  mynotificationmanager.notify(notification_id, mynotification.build()); 

but need set notification, not possible delete swipe side. everytimes can delete swiping. how disable that?

thank you

the notification builder has method setongoing. set true make notification ongoing notification can't dismissed user.

set whether "ongoing" notification. ongoing notifications cannot dismissed user, application or service must take care of canceling them. typically used indicate background task user actively engaged (e.g., playing music) or pending in way , therefore occupying device (e.g., file download, sync operation, active network connection).


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -