Android:通过代码获取所有通知

发布于 2024-09-06 03:06:55 字数 161 浏览 1 评论 0 原文

我正在使用一些家庭替代品,它允许我隐藏通知栏,这是我真正喜欢的东西。

所有信息都可以用一些小部件替换,但我也想显示通知。

由于我已经开发了一些应用程序,我想知道是否有一个命令行允许应用程序获取所有通知。我计划将其添加到小部件或吐司中。

非常感谢任何线索或帮助。

I am using some home replacement that allow me to hide the notification Bar and that's something I really like.

All the informations can be replaced by some widgets, but I would like to display the notifications too.

As I already developed some applications, I would like to know if there is a command line that allow an application to get all the notifications. I plan to add this to a widget or a toast.

Thank a lot for any clue or help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

萌梦深 2024-09-13 03:06:55

从 Android API Level 18 (Android 4.3) 开始,有一个类 NotificationListenerService
您必须设置权限BIND_NOTIFICATION_LISTENER_SERVICE,并将意图过滤器与操作NotificationListenerService结合使用。

 <service android:name=".NotificationListener"
          android:label="@string/service_name"
          android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
     <intent-filter>
         <action android:name="android.service.notification.NotificationListenerService" />
     </intent-filter>
 </service>

来源:http://developer.android.com/reference/android/服务/通知/NotificationListenerService.html#getActiveNotifications()

Since Android API Level 18 (Android 4.3) there is a class NotificationListenerService.
You must set the Permission BIND_NOTIFICATION_LISTENER_SERVICE and use a intent-filter with the action NotificationListenerService.

 <service android:name=".NotificationListener"
          android:label="@string/service_name"
          android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
     <intent-filter>
         <action android:name="android.service.notification.NotificationListenerService" />
     </intent-filter>
 </service>

Source: http://developer.android.com/reference/android/service/notification/NotificationListenerService.html#getActiveNotifications()

绻影浮沉 2024-09-13 03:06:55

我会回答我的问题,因为我在其他论坛上找到了一些东西。

似乎您可以访问它们,将您的应用程序声明为(对不起,法语术语,我找不到英文翻译)“gestionnaire d'accessibilité”,您可以将其翻译为“可访问性管理器”

更多信息:https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent。 html

这可能很危险并且有很多负面影响,但是另一位也在开发自定义主页的开发人员向我保证此功能有效,并且他能够创建自己的通知栏。

I will answer my question because I found something on an other forum.

Seem that you can access them declaring your application as an (sorry for the french term, I couldn't find an english translation) "gestionnaire d'accessibilité" that you may translate as "accessibility manager"

More information here: https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html

That may be dangerous and has a lot of negative point, but an other dev that is also working on a custom Home assure me that this feature work and he was able to create his own notification bar.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文