Reputation: 555
I have a notification on one of my services. Below is the code:
Notification notification = new NotificationCompat.Builder(this)
.setContentIntent(contentIntent)
.setContentTitle("title")
.setContentText("content")
.setSmallIcon(R.drawable.ic_small_notif)
.setLargeIcon(bitmap)
.setSound(alarmSound)
.setColor(Color.parseColor("#999999"))
.build();
startForeground(100,
notification);
I still confused how to stop this programmatically when I want to. Any suggestions?
Upvotes: 1
Views: 2468
Reputation: 318
try this
NotificationManager manager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
manager.cancel(mnotinotifId);
manager.cancelAll();
Upvotes: 0