2014-10-29 40 views
0

我需要获取状态栏通知,即我需要获取状态栏通知的文本作为字符串和显示在列表视图(每个应用程序)。是否有可能从ICS,任何想法请。阅读状态栏通知作为字符串

+0

你可能要检查:http://gmariotti.blogspot.com.tr/2013/11/notificationlistenerservice-and- kitkat.html – iamkaan 2014-10-29 14:05:08

回答

1

您可以使用AccessibilityService侦听新的通知。看看示例:http://pankajchunchun.wordpress.com/2013/07/09/capture-toast-or-notification-using-accessibility-service/

此解决方案有一个缺点 - 您必须在设备设置中启用服务,然后才能够收听通知。

另一种方法是使用NotificationListenerService API,但它可以从Android 4.3的: https://developer.android.com/reference/android/service/notification/NotificationListenerService