13

I am aware of the camera availability on Nexus 7 so I changed my manifest making the permission not required as follow:

<uses-permission android:name="android.permission.CAMERA" android:required="false"/>

The app is still not available. At this point I am confused from the doc which talks about uses-feature rather than user-permission:

Be aware of which system features that you declare (or imply) are required to run your application or the Play Store will not make your application available to Nexus 7 users. Always declare hardware features that aren't critical to your app as required="false" then detect at runtime if the feature is present and progressively enhance functionality

What's the deal here? I am confused about the difference between features and permissions.

athspk
  • 6,722
  • 7
  • 37
  • 51
gwvatieri
  • 5,133
  • 1
  • 29
  • 29
  • Do you have tag in your manifest? doesn't have required field. http://developer.android.com/guide/topics/manifest/uses-permission-element.html – auselen Sep 05 '12 at 22:00
  • I don't user the tag in my manifest – gwvatieri Sep 05 '12 at 22:02
  • Did you add before uploading to Google Play? That might be the reason. uses-permission doesn't have required tag, so may be Manifest is prepared as you asked for Camera permission (which should be visible in app information?) – auselen Sep 05 '12 at 22:04

1 Answers1

22

uses-feature declares what types of hardware/software availability your app uses. You can use this to automatically narrow down what types of devices it will appear to. You can declare any of these features as optional, if the app is able to still function without them, and is designed to handle situations in which the feature is unavailable (such as with the Nexus 7 as you mentioned).

uses-permission declares what types of functions your app is allowed to use. If you declare the permission, as you've done, it lets the user know "Hey, this app is allowed to use my camera" and they can decide whether or not to approve that usage. You cannot mark a permission as optional.

You should instead leave the required attribute off of the uses-permission tag, and add another tag for the camera with uses-feature, and in that tag, mark it as required="false". For example:

<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>

EDIT: Reading this document, it appears you may also have to add:

<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>

since the camera permission implies the requirement of these two features. It may work without this extra tag, but it probably wouldn't hurt to be over-specific, just in case.

Kevin Coppock
  • 133,643
  • 45
  • 263
  • 274
  • Ok, it makes sense, thanks. (I wish the ADT would warn when you are not using properly a tag, I could have avoided to release the app again just for that) – gwvatieri Sep 05 '12 at 22:18
  • I'm actually surprised it compiled that way. There must not be built-in checking for some manifest tags or something? Not sure, but hopefully this solves your problem. :) – Kevin Coppock Sep 05 '12 at 22:20
  • Yeah I am surprised too. It would be nice to have a tool on google play which given the apk and the device it tells you available/not available and if not available the reason. Right now I'll find out after releasing the app again :-). Thanks again – gwvatieri Sep 05 '12 at 22:24
  • 4
    I *think* you can look at which devices it is available and not available on once you've uploaded an APK, but I definitely agree, it is exasperating that they don't tell you *why* it's not available for a given device. – Kevin Coppock Sep 05 '12 at 22:27