how to Hide notification after tap in android application -
this code gives notification on start of service
notificationcompat.builder mbuild = new notificationcompat.builder(getapplicationcontext()); intent in = new intent(getapplicationcontext(), mainactivity.class); pendingintent resultin = pendingintent.getactivity(getapplicationcontext(),code,in,notification_count); mbuild.setsmallicon(r.drawable.images1); mbuild.setcontenttext(notification_count +" new message"); mbuild.setcontentintent(resultin); //mbuild.addaction(r.drawable.notifications,notification_count +"new messages",resultin); notificationmanager nmagr = (notificationmanager) getsystemservice(notification_service); nmagr.notify(1, mbuild.build());
everyting working correct ..the code opens target activity notification still stays there in notification bar. have tried useing mbuil.setautocancel(true); doing nothing
try this
notificationmanager nmagr = (notificationmanager) getsystemservice(notification_service); notification notification=mbuild.build(); notification.flags = notification.flag_auto_cancel; nmagr.notify(1,notification);
Comments
Post a Comment