无法获取NotificationListenerService类工作 [英] Cannot get the NotificationListenerService class to work

查看:122
本文介绍了无法获取NotificationListenerService类工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android应用程序正试图使用​​一个继承自这个类的API 18.我已经创建了自己的服务类新NotificationListenerService类,并覆盖了onNotificationPosted和onNotificationRemoved事件,虽然我的服务似乎开始就好了这些2事件似乎从来没有被调用时,我得到或删除通知。

I have a android application that is trying to use the new NotificationListenerService class from api 18. I have created my own service class that inherits from this class and overrode the onNotificationPosted and onNotificationRemoved events and although my service seems to start just fine these 2 events never seem to be called when I get or remove a notification.

有没有人有这个类或可能任何源$ C ​​$ C任何成功他们将分享演示究竟是如何使用这个类?

Has anyone had any success with this class or possibly any source code they are will to share demonstrating exactly how to use this class?

推荐答案

我刚刚翻过这一类行动的一个伟大的小例子:

I have just come accross a great little example of this class in action:

http://www.kpbird.com/2013/07/android- notificationlistenerservice.html

有一件事情我从下面这个例子学到的是,该通知服务,我创建启动时自动许可通过新的通知访问屏幕理所当然的,这意味着我的应用程序并不需要手动启动该服务。

One thing I learned from following this example is that the notification service I created starts automatically when permission is granted via the new notification access screen, meaning my application doesn't have to start the service manually.

这篇关于无法获取NotificationListenerService类工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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