【发布时间】:2012-07-12 12:32:17
【问题描述】:
我希望我的应用程序能够访问 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" />
但是,我不确定这是否足够,因为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" /> 还不够吗?
【问题讨论】:
-
它明确地说并强调了“和”,所以我认为你需要把所有的使用特征都写进去。
标签: android android-permissions