在 android 4.0 中获取 NotificationListener
Getting NotificationListener in android 4.0
我制作了一个应用程序,通过首先设置这个从通知中获取数据
Intent intent=new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
startActivity(intent);
此代码 运行 运行 在 api 级别 21 中很好,但是当我尝试 运行 相同的代码用于 api 级别 17 时出现错误
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS }.
请帮忙。
ACTION_NOTIFICATION_LISTENER_SETTINGS
并且 Android NotificationListenerService
已添加到 API 级别 18。
参考 - NotificationListenerService API
尽管您不能使用 NotificationListenerService
pre-API 18 this blog documents 如何使用 AccessibilityService
捕获通知事件(在 API 中介绍4), 或许对你有所帮助
我制作了一个应用程序,通过首先设置这个从通知中获取数据
Intent intent=new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
startActivity(intent);
此代码 运行 运行 在 api 级别 21 中很好,但是当我尝试 运行 相同的代码用于 api 级别 17 时出现错误
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS }.
请帮忙。
ACTION_NOTIFICATION_LISTENER_SETTINGS
并且 Android NotificationListenerService
已添加到 API 级别 18。
参考 - NotificationListenerService API
尽管您不能使用 NotificationListenerService
pre-API 18 this blog documents 如何使用 AccessibilityService
捕获通知事件(在 API 中介绍4), 或许对你有所帮助