没有“使用使用情况数据的应用程序”的设备或android.settings.USAGE_ACCESS_SETTINGS意图 [英] Devices without "Apps using Usage Data" or android.settings.USAGE_ACCESS_SETTINGS intent

查看:370
本文介绍了没有“使用使用情况数据的应用程序”的设备或android.settings.USAGE_ACCESS_SETTINGS意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景
Android 5引入了新的使用情况统计 API,可用于查询在不同应用上花费的时间。该API在多个应用中用于检测当前的前景应用(如几个问题所述,例如),但是:

Background: Android 5 introduced a new UsageStats API that can be used to query time spent with different apps. This API is used in several apps for detecting the current foreground app (as discussed in several questions, like this), but:


此API需要权限android.permission.PACKAGE_USAGE_STATS,这是系统级权限,不会授予第三方应用程序。但是,声明权限意味着使用API​​的意图,设备的用户可以通过设置应用程序授予权限。

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 。但是有时甚至没有此设置可用:

As the permission is not presented to the user, apps send the user to Settings using an intent with the action android.settings.USAGE_ACCESS_SETTINGS. But sometimes not even this setting is available:


在某些情况下,可能不存在匹配的Activity,因此请确保对此加以防范。 / p>

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

这意味着在这些手机中,几乎不可能访问使用情况统计。

Which means that in those phones, it's practically impossible to get access to the usage stats.

这已在其他问题中讨论过,例如此处此处。显然,一些制造商决定从某些设备(尤其是三星和LG,但也可能是其他设备)中删除该功能。

This has been discussed in other questions, like here and here. Apparently some manufacturers decided to remove the functionality from some devices (notably Samsung and LG, but maybe others also).

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

The question: The purpose of this question is to collect information about those devices that do not allow access to these settings. Please post brand, model and os version where you have found that this is the case. Additionally, if someone can find an alternative way of accessing the usage stats, it would be helpful for others if you share it.

请避免指向已弃用的API,例如 getRecentTasks ,或 getRunningAppProcesses (通常会返回带有优先级前景),或者如何配置 Manifest 文件。

Please avoid pointing to deprecated APIs like getRecentTasks, or getRunningAppProcesses (which often returns several packages with priority foreground), or to how to configure the Manifest file.

推荐答案

我将从确认没有回答意图的列表开始:

I'll start with a list that I have confirmed don't answer to the intent:

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

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

Also, some of our users complained with:

LG G3                     5.0

这篇关于没有“使用使用情况数据的应用程序”的设备或android.settings.USAGE_ACCESS_SETTINGS意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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