android - Prevent notification from being swiped off tray -


is possible prevent notification being swiped out of notification tray? usb notifications. if not, there sort of listener 1 can implement scenario?

you can making notifications sticky

private void makenotification(context context) { intent intent = new intent(context, mainactivity.class);  pendingintent pendingintent = pendingintent.getactivity(context,     notification_id, intent, pendingintent.flag_update_current);  notification.builder builder = new notification.builder(context)     .setcontenttitle("notification title")     .setcontenttext("sample notification content")     .setcontentintent(pendingintent)     .setsmallicon(r.drawable.ic_action_picture)     .setlargeicon(bitmapfactory.decoderesource(getresources(), r.drawable.ic_launcher))     ; notification n;  if (build.version.sdk_int >= build.version_codes.jelly_bean) {     n = builder.build(); } else {     n = builder.getnotification(); }  n.flags |= notification.flag_no_clear | notification.flag_ongoing_event;  notificationmanager.notify(notification_id, n); 

}


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -