Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if my application's notification is running

Is there a way I can check programatically whether my app's notification is currently running(shown)?

That is to say that NotificationManager.notify() was invoked.

like image 298
kkudi Avatar asked Jan 20 '23 06:01

kkudi


1 Answers

Is there a way I can check programatically whether my app's notification is currently running(shown)?

No.

That is to say that NotificationManager.notify() was invoked.

You called notify(). Hence, you already know if notify() was called. You also know if your code calls cancel() or cancelAll(). You will also know, via the various PendingIntents and flags, if the Notification goes away based upon user action. Hence, you have all of the information yourself to determine if the Notification is on-screen or not.

However, savvy developers will write their apps such that they do not care if their Notification is on-screen or not.

like image 189
CommonsWare Avatar answered Jan 29 '23 02:01

CommonsWare