Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid Android Market filtering on optional use of location

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

e.g.

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

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

When I upload to Android market I get this reported:

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

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?)?

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

like image 640
Andrew Mackenzie Avatar asked May 17 '11 13:05

Andrew Mackenzie


1 Answers

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:

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.

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!

like image 73
Deepak Sarda Avatar answered Oct 13 '22 12:10

Deepak Sarda