国内很多家的APP为了适配平板都会做两个版本,一个手机版,一个平板版,但是在GooglePlay上手机和平板只能用一个app,而且在GooglePlay上平板如果搜不到应用,提示的也很笼统(提示:信息中心-->用户获取数据-->优化提示-->设计出适合平板电脑的应用),问了大神再结合GooglePlay给的提示,终于完成了任务!
7寸平板:不要再使用layout-large,使用layout-sw600dp。说明:Nexus 7 = 960 X 600 dp;最小的尺寸是600。
10寸平板:不要再使用layout-xlarge,使用layout-sw720dp。
说明:Nexus 10 = 1280 X 800 dp;最小的尺寸是800。不过有些10寸的平板像素可能要更小一点,所以这里取720只是我们常用的中间值。
使用-swXXdp或wXXdp的一些规则不止上面说的这些(你应该根据界面内容合理显示所需要的最小尺寸来决定-swXXdp中XX的取值,而不是通过一个设备本身的尺寸),如果你在平板上的布局和手机上的要求一样,那就直接把布局复制到这两个文件夹里就可以。
Google官方给出的https://developer.android.com/guide/topics/manifest/uses-feature-element.html(需要翻墙),非常详细,简言之就是手机的一些硬件功能平板可能不会支持,需要一些设置将不支持的过滤掉。
当用户启动 Google Play 时,应用通过调用 getSystemAvailableFeatures()
在软件包管理器中查询设备上提供的功能列表。 然后,Google 商店应用会在为用户建立会话时将功能列表向上传递给 Google Play。
您每次向 Google Play Developer Console 上传应用时,Google Play 都会扫描应用的清单文件。 它会寻找 <uses-feature>
元素并在某些情况下结合其他元素(例如 <uses-sdk>
和 <uses-permission>
元素)对其进行评估。 在建立应用所需的功能集之后,它会在内部将该列表存储为与应用 .apk
和应用版本关联的元数据。
根据显式声明的功能进行过滤
显式声明的功能是指您的应用在 <uses-feature>
元素中声明的功能。 功能声明可包括 android:required=["true" | "false"]
属性(如果您编译的应用面向 API 级别 5 或更高版本),您可以通过它指定应用是绝对需要该功能,没有它便无法正常工作(设置为 "true"
时),还是应用会在提供了该功能时予以优先使用,但应用本身设计为不使用它也能正常运行(设置为 "false"
时)。
Google Play 按以下方式处理显式声明的功能:
- 如果一项功能被显式声明为所需功能,Google Play 会将该功能添加到应用的所需功能列表。 然后,它会从不提供该功能的设备上滤除该应用,让用户无法看到。例如:
<uses-feature android:name="android.hardware.camera" android:required="true" />
- 如果一项功能被显式声明为并非所需功能,Google Play 不会将该功能添加到所需功能列表。 因此,在过滤应用时,从不会考虑显式声明的非所需功能。 即使设备不提供声明的功能,Google Play 仍会考虑与设备兼容的应用并将其显示给用户,除非有其他过滤规则适用。 例如:
<uses-feature android:name="android.hardware.camera" android:required="false" />
- 如果显式声明了某个功能,但未加入
android:required
属性,则 Google Play 会假定该功能是所需功能,并对其设置过滤。
一般而言,如果您的应用设计为在 Android 1.6 及更低版本上运行,API 中不提供 android:required
属性,Google Play 会假定任何以及所有 <uses-feature>
声明都是所需功能。
当用户利用 Google Play 应用搜索或浏览应用时,该服务会将各应用需要的功能与用户设备上提供的功能进行比较。 如果设备提供了应用所需的全部功能,则 Google Play 允许用户看到该应用并可能允许用户下载该应用。 如果设备不支持任何所需功能,Google Play 会滤除该应用,令其对用户不可见,也无法供用户下载。
已经解释的很清楚了,也就是说要把所有的硬件都设置成
<uses-featureandroid:name="android.hardware.XXX"android:required="false"/>这种形式。
<uses-feature android:name="android.hardware.microphone" android:required="false"/>
<uses-feature android:name="android.hardware.bluetooth" android:required="false"/><uses-feature android:name="android.hardware.location.network" android:required="false"/> <uses-feature android:name="android.hardware.location." android:required="false"/> <uses-feature android:name="android.hardware.location.gps" android:required="false"/><uses-feature android:name="android.hardware.wifi" android:required="false"/> <uses-feature android:name="android.hardware.screen.portrait" android:required="false" /> <uses-feature android:name="android.hardware.camera.front" android:required="false"/> <uses-feature android:name="android.hardware.camera.flash" android:required="false"/> <uses-feature android:name="android.hardware.telephony" android:required="false"/> <uses-feature android:name="android.hardware.microphone" android:required="false"/> <uses-feature android:name="android.hardware.camera" android:required="false"/> <uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
蓝牙 | BLUETOOTH | android.hardware.bluetooth (如需了解详情,请参阅针对蓝牙功能的特殊处理。) |
BLUETOOTH_ADMIN | android.hardware.bluetooth | |
相机 | CAMERA | android.hardware.camera 和 android.hardware.camera.autofocus |
定位 | ACCESS_MOCK_LOCATION | android.hardware.location |
ACCESS_LOCATION_EXTRA_COMMANDS | android.hardware.location | |
INSTALL_LOCATION_PROVIDER | android.hardware.location | |
ACCESS_COARSE_LOCATION | android.hardware.location.network 和 android.hardware.location | |
ACCESS_FINE_LOCATION | android.hardware.location.gps 和 android.hardware.location | |
麦克风 | RECORD_AUDIO | android.hardware.microphone |
电话 | CALL_PHONE | android.hardware.telephony |
CALL_PRIVILEGED | android.hardware.telephony | |
MODIFY_PHONE_STATE | android.hardware.telephony | |
PROCESS_OUTGOING_CALLS | android.hardware.telephony | |
READ_SMS | android.hardware.telephony | |
RECEIVE_SMS | android.hardware.telephony | |
RECEIVE_MMS | android.hardware.telephony | |
RECEIVE_WAP_PUSH | android.hardware.telephony | |
SEND_SMS | android.hardware.telephony | |
WRITE_APN_SETTINGS | android.hardware.telephony | |
WRITE_SMS | android.hardware.telephony | |
Wi-Fi | ACCESS_WIFI_STATE | android.hardware.wifi |
CHANGE_WIFI_STATE | android.hardware.wifi | |
CHANGE_WIFI_MULTICAST_STATE | android.hardware.wifi |