I have a background service running to get data. I check for new data and send status bar notification. Sending notification is part of the service. When user sees that notification, he logs on to the application and accepts it. That time I want to delete it from status bar. Can I do that ?
To dismiss a notification, touch it and swipe left or right. Tap the dismiss icon to dismiss all notifications. On newer versions of Android, you can manage some notifications from the lock screen. Double-tap a notification to open the app or swipe left or right to dismiss the notification.
To remove a persistent notification on Android as fast as possible, first, press-and-hold on it. Alternatively, swipe the notification left or right to reveal a gear icon on either side, and then tap on it. The notification expands. Tap on “Turn off notifications” at the bottom.
Check your app notification settings Go to your profile picture . Tap Notifications. Tap the sliders to turn off notification options.
if (Context.NOTIFICATION_SERVICE!=null) {
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager nMgr = (NotificationManager) getApplicationContext().getSystemService(ns);
nMgr.cancel(0);
}
write the above code in the second class and create the notifications in the first class using the id 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With