android - Swipe dismissing service notification -


thought wouldn't problem @ all, still. service notification doesn't want swipe-dismiss no matter do.

i have progress notification, started in service using startforeground(id, notification). here how build it:

public notification createerrornotification(string message) {     notificationcompat.builder builder = new notificationcompat.builder(getapplicationcontext());      intent showappintent = new intent(getapplicationcontext(), mainactivity.class);     showappintent.setaction(intent.action_main);     showappintent.addcategory(intent.category_launcher);     pendingintent pendingshowappintent = pendingintent.getactivity(getapplicationcontext(), 10,             showappintent, pendingintent.flag_cancel_current);       builder.setcontenttitle(getstring(r.string.label_download_error))             .setwhen(0)             .setcontenttext(message)             .setcontentintent(pendingshowappintent)             .setautocancel(true)             .setongoing(false)             .setsmallicon(r.drawable.ic_launcher);      return builder.build(); } 

at point if error occurs, replace progress notification described error notification, disabling 'ongoing' , other stuff. stop service completely:

private void stopservice() {     stopself();     taskthread.stoplooper();     downloadhandler.stopexecution();     downloadhandler = null;     taskthread = null; } 

and call

stopforeground(false); 

false - because want notification kept on screen , dismissed user. swipe-dismissing doesn't work.

if call stopforeground(true) - notification correctly removed.

anyone has ideas doing wrong here?

as @orium have suggested, resolve issue need stop services in foreground mode removing notification, , create new notification using same id, settings set dismissable. be: stopforegound(true) , create notification setautocancel(true)


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -