Reputation: 4408
In my app i include a library that request camera. This limits my application for devices without camera and i need it specifically for a device with scanner but no camera. So i want to make the camera permission as not required in my app. How can i do this.
I added
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
in my apps manifest. Is that enough?
Or should i add tools:node="remove" or tools:node="replace" in my app like as below
<uses-permission android:name="android.permission.CAMERA" tools:node="replace" />
Upvotes: 1
Views: 598
Reputation: 17824
Yes it's enough. You set it to be a non-required feature, so it's non-required.
Just because you use the CAMERA permission doesn't mean the device has to have a camera. You could put in:
<uses-permission android:name="hue.com.derp" />
And it wouldn't restrict your compatibility base at all. If the host device doesn't recognize a permission, it ignores it.
The tools
namespace has zero effect on runtime. It's simply for you to provide the IDE with a sample of what might happen during runtime, so it can update previews and the like.
Upvotes: 1
Reputation: 466
I would say check the device type first if it has camera & 6.0+ then you need to ask for permission other wise just run your code normal
Upvotes: 0