检查我的应用程序的通知运行 [英] Check if my application's notification is running

查看:88
本文介绍了检查我的应用程序的通知运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法,我可以编程方式检查是否我的应用程序的通知,目前正在运行(如图所示)?

这是说, NotificationManager.notify()被调用。


解决方案

  

有没有一种方法,我可以编程方式检查是否我的应用程序的通知,目前正在运行(如图所示)?


没有。


  

这就是说,NotificationManager.notify()被调用


您名为通知()。因此,你已经知道,如果通知()被调用。你也知道,如果你的code调用取消() cancelAll()。你也知道,通过各种 PendingIntents 和标志,如果通知消失根据用户操作。因此,你把所有的信息自己确定通知是屏幕上还是不行。

不过,精明的开发商会编写自己的应用程序,使得他们不关心,如果他们的通知是屏幕上还是不行。

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.

解决方案

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.

这篇关于检查我的应用程序的通知运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆