Skip to content Skip to sidebar Skip to footer

How To Force Permission "android.permission.camera" To Be Added To Manifest In Codename One

I am trying to show a live preview of the rear facing camera in Codename One. I use for that the native interface (I am targetting Android first). To allow my app to use the camer

Solution 1:

You need to add the following build hint:

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

You can also add this to the cn1lib so it is injected automatically.

Solution 2:

In the past, you add the permission you want to your manifest and then it is requested when your user attempts to install your app. As of Android 6.0+, this has changed. Now you can just request a permission when your app needs it for the first time. After the user grants you permission, you don't need to ask again next time. Some benefits of this include keeping your user aware of why you need specific permissions and not requesting permissions that you don't actually need.

You can read more about how to implement it here: https://developer.android.com/training/permissions/requesting.html

There is no way to use a phones camera without asking for permission at some point.

Post a Comment for "How To Force Permission "android.permission.camera" To Be Added To Manifest In Codename One"