首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

Google Play跟基于Feature的过滤

2013-09-07 
Google Play和基于Feature的过滤田海立@CSDN翻译自Google Play and Feature-Based FilteringGooglePlay会

Google Play和基于Feature的过滤

田海立@CSDN

翻译自Google Play and Feature-Based Filtering



GooglePlay会过滤出那些对用户可见的应用程序,因此用户只能看到和下载那些与他们的设备兼容的应用程序。过滤应用程序其中的一种方法就是通过Feature兼容性。

Google Play为判断应用程序与给定的用户设备是否兼容,比较:

应用程序需要的Feature– 应用程序在它自己的manifest中通过<uses-feature android:name="android.hardware.camera" android:required="true" />

如果一个Feature被明确声明为非必须的,GooglePlay就不会把这个的Feature添加到所需的Feature列表中。由于这个原因,明确声明的非必须的Feature,在GooglePlay过滤应用程序时就不会被考虑。即使设备不声明提供该Feature,GooglePlay依然会认为该应用程序与设备是兼容的,并允许显示给用户,除非使用了其他过滤规则。例如:

<uses-feature android:name="android.hardware.camera" android:required="false" />

如果一个Feature被明确声明,但没有设置<uses-feature android:name="android.hardware.camera" android:required="false" />

理解用

如果

结果

<=4 (或者uses-sdk没被申明)

<=4

对于任何报告其支持

<=4

>=5

对于任何不支持

>=5

>=5

以下的例子,基于GooglePlay如何处理蓝牙Feature,演示了不同的过滤效果。

第一个例子中,应用程序被设计成要运行在比较旧的APILevel上并声明了蓝牙权限,但是它没有在其$ aapt dump badging <path_to_exported_.apk>

以下例子是针对上面第二个蓝牙的例子的命令输出:

$ ./aapt dump badging BTExample.apkpackage: name='com.example.android.btexample' versionCode='' versionName=''uses-permission:'android.permission.BLUETOOTH_ADMIN'uses-feature:'android.hardware.bluetooth'sdkVersion:'3'targetSdkVersion:'5'application: label='BT Example' icon='res/drawable/app_bt_ex.png'launchable activity name='com.example.android.btexample.MyActivity'label='' icon=''uses-feature:'android.hardware.touchscreen'mainsupports-screens: 'small' 'normal' 'large'locales: '--_--'densities: '160'