- How to cancel notification in android programmatically?
- How to enable and disable notification in android programmatically?
- How to hide notification bar in android programmatically?
How to cancel notification in android programmatically?
In the service you have to call cancelAllNotifications() . The service has to be enabled for your application via 'Apps & notifications' -> 'Special app access' -> 'Notifications access'. After that use the broadcast receiver to trigger the clear all.
How to enable and disable notification in android programmatically?
You would have to keep a Boolean flag and add a check before posting a notification from your app. Save that Boolean flag in SharedPreferences. Once the user or your app disables/enables notifications, make that reflect in the SharedPreferences.
How to hide notification bar in android programmatically?
Hide the Status Bar on Android 4.
View decorView = getWindow(). getDecorView(); // Hide the status bar. // status bar is hidden, so hide that too if necessary.