Warning: Do Not Use android.hardware.camera.any Yet

It’s amazing the things that you stumble upon when reading StackOverflow.

A gentleman posted a popular sort of question, inquiring about why his app was listed by the Play Store as supported by “only 3 (out of 2263)”. As is typical with this sort of question, he posted his manifest, in hopes that we could determine what rogue element was causing his grief.

One element popped out at me: <uses-feature android:name="android.hardware.camera.any" />

My initial reaction was that this was an invented feature. It turns out that android.hardware.camera.any is real and was added in API Level 17 (Android 4.2), to address the issues caused by the Nexus 7 and potential other future devices with a front-facing camera and no rear-facing camera.

However, this issue indicates that the Play Store is not up to speed just yet:

However, the Play Store needs new logic to provide backwards compatibility for devices with older OS releases, which is not yet ready.

So until that support is in place, don’t use “android.hardware.camera.any”, as any apps requiring it will not yet be installable on devices running pre-4.2 versions.

That certainly would fit the symptoms, as Android 4.2 is only officially available for a few models right now.

Alas, there is no warning in the actual documentation about this limitation.

Hence, be very careful when using android.hardware.camera.any. Either avoid it altogether or make it not required (android:required="false"). If you do elect to use it, double-check your entry in the Play Store to make sure that your app is showing up for the right number of devices, until we collectively feel comfortable that the Play Store has indeed taken this new feature into account.

Find out about new posts on the CommonsBlog via the Atom feed, or follow @CommonsWare on Twitter!