避免在可选使用位置时进行 Android Market 过滤 [英] Avoid Android Market filtering on optional use of location

查看:32
本文介绍了避免在可选使用位置时进行 Android Market 过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,如果可用,我会尝试使用位置信息.因此,我的清单中有这些权限:

In my app I try and use location information if it is available. Hence I have those permissions in my manifest:

例如

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

注意:我没有 for location,这是我理解的用于在 Android Market 中过滤的标签.

NOTE: I DO NOT have a for location, which is the tag I understood was used for filtering in Android Market.

当我上传到 Android 市场时,我收到以下报告:

When I upload to Android market I get this reported:

此 apk 请求 4 个功能用于 Android Market 过滤android.hardware.location.networkandroid.hardware.locationandroid.hardware.location.gpsandroid.hardware.touchscreen

This apk requests 4 features that will be used for Android Market filtering android.hardware.location.network android.hardware.location android.hardware.location.gps android.hardware.touchscreen

这对我来说表明它只会显示在具有 location 和 location.network 和 gps 硬件的设备上.

which to me suggests that it will only show up for devices that have location and location.network and gps hardware.

但我对位置的使用是可选的,如果它不可用,应用程序将运行.

But my use of location is optional and the app will work if it is not avaialble.

我应该从我的清单中删除这些权限吗(当我尝试使用它时会出现异常吗?)?

Should I remove those permissions from my manifest (will I get exceptions when I try to use it?)?

有没有办法离开权限并避免基于它们的Android Market过滤?

Is there a way to leave the permissions and avoidAndroid Market filtering based on them?

推荐答案

我的应用程序有同样的问题.我猜这是因为 minSdkVersion 是 4,即 Android 1.6.来自 <uses-功能>文档:

My application has the same problem. I guess this is because the minSdkVersion is 4, i.e. Android 1.6. From the <uses-feature> documentation:

一般来说,如果您的应用程序设计为在 Android 1.6 及更早版本上运行,则 android:required 属性在 API 中不可用,并且 Android Market 假定所有声明都是必需的.

In general, if your application is designed to run on Android 1.6 and earlier versions, the android:required attribute is not available in the API and Android Market assumes that any and all declarations are required.

这是有道理的,因为当您将功能声明为可选时,您应该使用 hasSystemFeature() 方法从 PackageManager 检查是否当前设备具有该特定功能.但是,此方法本身仅在 API 级别 5 中可用!

This makes sense because when you declare a feature as optional, you are supposed to use the hasSystemFeature() method from the PackageManager to check whether the current device has that particular feature. However, this method itself is available only from API Level 5!

这篇关于避免在可选使用位置时进行 Android Market 过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆