Android uses-permission

How can permissions be added to an Android export?

In detail do I have to add the following to the generated AndroidManifest

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

I solved it.

I added the following line to my Type declaration in the .uxl

<Require Android.Manifest.RootElement="&lt;uses-permission android:name=&quot;android.permission.CAMERA&quot;/&gt;" />

Well you beat me to it! This will work for uxl.

For those using bindings you can do the following:

Permissions.RequestPermission(Permissions.CAMERA);

Given that I can do this for <uses-permission>:

<Package>
  <Extensions Backend="CPlusPlus" Condition="Android">
    <Require AndroidManifest.Permission="android.permission.NFC" />
  </Extensions>
</Package>

Is there a better (neater) way I can add <uses-feature> than the method suggested above?
Eg. for <uses-feature android:name="android.hardware.nfc.hce" android:required="false"/>

Thanks!

Looking at other libraries, it seems there is a better way. Here’s more details on what else you can do to Manifest.

@Iain actually it’s best not to set permissions that way as then you can end up with issues on android versions >6. See here for details https://www.fusetools.com/docs/native-interop/android-permissions