Check if my notification application is running

Is there a way I can check programmatically if my application is currently running (shown)?

That is, NotificationManager.notify() called.

+4
source share
3 answers

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.

+4
source

Is there a way I can check programmatically if my application is currently running (shown)?

Yes. Take a look at this: How do I know when my notification is cleared using the "Clear" button?

@ octavian-damiean said:

It looks like you are looking for the deleteIntent field of the Notification class.

+3
source

You can use API 23 and above. Just call NotificationManager.getActiveNotifications() .

+1
source

Source: https://habr.com/ru/post/1343499/


All Articles