pan*_*dre 9 android android-permissions
如果可用,我希望我的应用程序访问GPS /网络位置.我不希望Google Play过滤掉没有GPS /网络定位器的设备.
我该怎么做?
目前我的清单上有这个:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-feature android:name="android.hardware.location" android:required="false" />
Run Code Online (Sandbox Code Playgroud)
但是,我不确定这是否足够,因为http://developer.android.com/guide/topics/manifest/uses-feature-element.html#permissions-features声明:
-permission ACCESS_COARSE_LOCATION意味着android.hardware.location.network和
android.hardware.location功能要求
-permission*ACCESS_FINE_LOCATION意味着android.hardware.location.gps和
android.hardware.location
难道我还必须添加
<uses-feature android:name="android.hardware.location.network" android:required="false" />
和
<uses-feature android:name="android.hardware.location.gps" android:required="false" />?
为什么?
应该<uses-feature android:name="android.hardware.location" android:required="false" />不够?
是的,由于权限在 API 中的存储方式,您必须将它们全部包含在内。它们作为字符串存储在PackageManager 类中。以您关心的android.hardware.location为例。看看该字符串如何与您在清单中键入的字符串完全相同。Google Play 在过滤时会查找这些完全匹配的内容。Soandroid.hardware.location.gps实际上并不是 的子级android.hardware.location,它只是为了组织而这样表示。
| 归档时间: |
|
| 查看次数: |
6877 次 |
| 最近记录: |