I am a beginner for Java Coding and is currently coding an Android Project. Right now, I am facing an issue. I want my application
to auto remove the notification
at a particular time.
I've managed to dismiss the notification
after user click on the notification
. However, at the same time, I also want the notification
to auto disappear after a specific time if the user did not react to the notification
.
Please advise me on how should I do it. If possible, please provide me some examples.
You can start a timer for required seconds as soon you call the method to show notification and inside onFinish() of the timer you can add something like this :
NotificationManager nMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nMgr.cancelAll();
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