1

I have an android app which, in the build.gradle file, lists the minSdkVersion as 23 (which should match down to Android 6.0) and the targetSdkVersion of 26, as well as compile of 26.

My device is a Zebra TC20, which is of android version 7.1.

I believe the issue is that my app allows the user to access the camera for a particular (optional) feature - the TC20 has no camera. I've tried to use the feature on the TC20 and it crashes.

So of course like any developer, I googled around to find out what's going on, and found this answer which suggests that you check if a feature is available before launching it, and I found this answer which describes how to check for CAMERA.

Now, my main activity wasn't using the Camera at all, but my main activity was launching another activity, via startActivityForResult, and THAT activity uses a camera. So what I've done in my code is in the main activity, before launching the activity that uses the camera, I check for the camera first if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)), and only launch if it does, otherwise show a toast that the camera isn't available.

I've installed the APK myself and checked that this works on the TC20 device, and it does in fact work. My question then is, is this likely to be sufficient to allow my app to be downloaded by the TC20 on the playstore? Will I need to do the feature request INSIDE of the other activity as well? What are the guidelines for doing a check like this for the playstore to allow it?

TKoL
  • 13,158
  • 3
  • 39
  • 73
  • 1
    https://stackoverflow.com/questions/30542162/google-play-says-your-device-isnt-compatible-with-this-version-in-all-devices – IntelliJ Amiya May 15 '19 at 09:48
  • @IntelliJAmiya so that's a great lead! My question then is this: at the moment, my Manifest says `uses-permission ... CAMERA` -- based on that answer, it looks like I just have to add ` ` and I'll be good? – TKoL May 15 '19 at 09:53
  • Does it matter if I put `uses-feature` before or after `uses-permission`? Do I have to put the `required` attribute on the permission too? – TKoL May 15 '19 at 09:54
  • @IntelliJAmiya considering I'm also using autofocus, should i include `` as well? – TKoL May 15 '19 at 10:04
  • You can do this. – IntelliJ Amiya May 15 '19 at 11:09

1 Answers1

1

Adding these to may app manifest worked:

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

per user IntelliJAmiya and this answer here

TKoL
  • 13,158
  • 3
  • 39
  • 73