如何查看哪些通知是活跃在Android开发状态栏? [英] How to check which notifications are active in status bar in Android Dev?
问题描述
我做了一个应用程序,设置在Android手机的下拉状态栏通知。然而,有在我的code进行错误(有时提示的,有时它们不是)。我希望能够检查(在code)如果通知是对用户可见。 (即可以在用户看到在状态栏上的通知?)。
我怎样才能做到这一点? (在此先感谢)。
样品code是大大AP preciated。
我希望能够检查(在code)如果通知是对用户可见。 (即可以在用户看到 在状态栏上的通知?)。
我怎样才能做到这一点?
<打击>你不能,对不起击>更新:现在可以与Android 4.3+ <一href="http://developer.android.com/reference/android/service/notification/NotificationListenerService.html#getActiveNotifications%28%29">http://developer.android.com/reference/android/service/notification/NotificationListenerService.html#getActiveNotifications()
不过,你总是可以简单地取消()
它 - 取消通知
不在屏幕上是完全正常的。相反,你可以随时安全地调用通知()
再次对同一通知
,它也不会引起问题如果通知
已经在屏幕上。
I have made an app that sets notifications in the drop-down status bar of Android phones. However, there is a bug in my code (sometimes the notifications are set, sometimes they are not). I want to be able TO CHECK (in the code) IF THE NOTIFICATION IS VISIBLE TO THE USER. (i.e. can the user see the notification in the status bar?).
How can I do this? (Thanks in advance).
Sample code is greatly appreciated.
I want to be able TO CHECK (in the code) IF THE NOTIFICATION IS VISIBLE TO THE USER. (i.e. can the user see the notification in the status bar?).
How can I do this?
You can't, sorry. Update: Now possible with Android 4.3+ http://developer.android.com/reference/android/service/notification/NotificationListenerService.html#getActiveNotifications()
However, you can always simply cancel()
it -- canceling a Notification
that is not on-screen is perfectly fine. Conversely, you can always safely call notify()
again for the same Notification
, and it too will not cause a problem if the Notification
is already on-screen.
这篇关于如何查看哪些通知是活跃在Android开发状态栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!