Is there a way I can check programmatically if my application is currently running (shown)?
No.
That is, NotificationManager.notify () is called.
You called notify() . Therefore, you already know if notify() was called. You also know if your code calls cancel() or cancelAll() . You also know through various PendingIntents and flags if the Notification disappears based on user action. Therefore, you have all the information to determine if the Notification screen is on-screen or not.
However, experienced developers will write their applications in such a way that they do not care if their Notification is on screen or not.
source share