需要了解 Android 中的使用功能
Need to know about uses-feature in Android
uses-feature
的用法如下:
<uses-feature
android:name="string"
android:required=["true" | "false"]
android:glEsVersion="integer" />
android:required
和android:glEsVersion
有什么用?
required
用于表明应用所使用的功能对应用来说是必不可少的;如果没有该功能,该应用程序将毫无用处或无法运行。例如,如果您的应用使用 gps 作为一项 很不错的 功能,但它不是绝对必要的,您可以将 required
设置为 false
。这样一来,使用不带 gps 设备的设备的用户仍然可以从 Play 商店下载您的应用程序,否则他们将无法下载。
glEsVersion
仅当该功能需要 OpenGL ES 时才需要。在这种情况下,您可能希望至少指定一个要在上下文中使用的版本。
或者如开发者指南所述:
required The element offers a required attribute that lets you specify whether your application requires and cannot function without the declared feature, or whether it prefers to have the feature but can function without it. (Android Dev Guidelines)
glEsVersion For some features, there may exist a specific attribute that allows you to define a version of the feature, such as the version of Open GL used (declared with glEsVersion). […] An application should specify at most one android:glEsVersion attribute in its manifest. If it specifies more than one, the android:glEsVersion with the numerically highest value is used and any other values are ignored. If an application does not specify an android:glEsVersion attribute, then it is assumed that the application requires only OpenGL ES 1.0, which is supported by all Android-powered devices. (Android Dev Guidelines)
您可以在 Android Developer Guidelines
中阅读有关 <uses-feature>
的更多信息
android:required 当每个设备都不支持您的应用程序所需的硬件或功能时很有用。
示例:我的应用程序可用于短信、联系人、通话记录、apk 等的备份目的。但是有些平板电脑没有 sim 卡,那么 android:required="false" 对我有用,如果那样的话该设备上的应用 运行。
android:glEsVersion The OpenGL ES version required by the application.
The higher 16 bits represent the major number and the lower 16 bits
represent the minor number. For example, to specify OpenGL ES version
2.0, you would set the value as "0x00020000", or to specify OpenGL ES 3.0, you would set the value as "0x00030000".
如android所述 developer.android:
<uses-feature>
允许您指定您的应用程序是否需要并且在没有声明的功能的情况下无法运行。
android:glEsVersion
应用程序所需的 OpenGL ES 版本。
uses-feature
的用法如下:
<uses-feature
android:name="string"
android:required=["true" | "false"]
android:glEsVersion="integer" />
android:required
和android:glEsVersion
有什么用?
required
用于表明应用所使用的功能对应用来说是必不可少的;如果没有该功能,该应用程序将毫无用处或无法运行。例如,如果您的应用使用 gps 作为一项 很不错的 功能,但它不是绝对必要的,您可以将 required
设置为 false
。这样一来,使用不带 gps 设备的设备的用户仍然可以从 Play 商店下载您的应用程序,否则他们将无法下载。
glEsVersion
仅当该功能需要 OpenGL ES 时才需要。在这种情况下,您可能希望至少指定一个要在上下文中使用的版本。
或者如开发者指南所述:
required The element offers a required attribute that lets you specify whether your application requires and cannot function without the declared feature, or whether it prefers to have the feature but can function without it. (Android Dev Guidelines)
glEsVersion For some features, there may exist a specific attribute that allows you to define a version of the feature, such as the version of Open GL used (declared with glEsVersion). […] An application should specify at most one android:glEsVersion attribute in its manifest. If it specifies more than one, the android:glEsVersion with the numerically highest value is used and any other values are ignored. If an application does not specify an android:glEsVersion attribute, then it is assumed that the application requires only OpenGL ES 1.0, which is supported by all Android-powered devices. (Android Dev Guidelines)
您可以在 Android Developer Guidelines
中阅读有关<uses-feature>
的更多信息
android:required 当每个设备都不支持您的应用程序所需的硬件或功能时很有用。
示例:我的应用程序可用于短信、联系人、通话记录、apk 等的备份目的。但是有些平板电脑没有 sim 卡,那么 android:required="false" 对我有用,如果那样的话该设备上的应用 运行。
android:glEsVersion The OpenGL ES version required by the application. The higher 16 bits represent the major number and the lower 16 bits represent the minor number. For example, to specify OpenGL ES version 2.0, you would set the value as "0x00020000", or to specify OpenGL ES 3.0, you would set the value as "0x00030000".
如android所述 developer.android:
<uses-feature>
允许您指定您的应用程序是否需要并且在没有声明的功能的情况下无法运行。
android:glEsVersion
应用程序所需的 OpenGL ES 版本。