没有“使用使用数据的应用”或android.settings.USAGE_ACCESS_SETTINGS意图的设备

背景:

Android 5引入了一个新的
UsageStats API,可用于查询使用不同应用程序所花费的时间.此API在多个应用程序中用于检测当前的前台应用程序(如几个问题中所述,如
this),但是:

This API requires the permission android.permission.PACKAGE_USAGE_STATS, which is a system-level permission and will not be granted to third-party apps. However, declaring the permission implies intention to use the API and the user of the device can grant permission through the Settings application.

由于未向用户显示权限,应用程序会使用具有操作android.settings.USAGE_ACCESS_SETTINGS的意图将用户发送到“设置”.但有时甚至不能使用此设置:

In some cases, a matching Activity may not exist, so ensure you safeguard against this.

这意味着在这些手机中,几乎不可能访问使用统计数据.

这已在其他问题中讨论过,例如herehere.显然,一些制造商决定从某些设备中删除该功能(特别是三星和LG,但也许还有其他设备).

问题:此问题的目的是收集有关不允许访问这些设置的设备的信息.请发布品牌,型号和操作系统版本,您发现是这种情况.此外,如果有人可以找到另一种访问使用统计信息的方法,那么如果您共享它,对其他人有帮助.

请避免指向已弃用的API,如getRecentTasksgetRunningAppProcesses(通常会返回多个具有优先级前景的包),或者指向如何配置Manifest文件.

最佳答案 我将从一个我已确认无法回答意图的列表开始:

Model                     OS version
Samsung Galaxy Note 3     5.0
Samsung Galaxy S4         5.0.1
Samsung Galaxy Note S4    5.0.1
Samsung Galaxy S5         5.0
Samsung Galaxy S5 CDMA    5.0
Meizu m2 note             5.1
Samsung Galaxy S5         5.0
OnePlus One               5.0.2
Meizu MX4                 5.0.1

此外,我们的一些用户抱怨:

LG G3                     5.0
点赞