How to force the permission "android.permission.CAMERA" to be added to the manifest in Codename one

I am trying to show a preview of a rear view camera in Codename One. I use my own interface for this (first I am targeting Android).

So that my application can use the camera without delving into the build tips, I added these lines to my main form:

if (Capture.hasCamera()){
     Dialog.show("Appareil photo détecté", "Votre matériel est bien équipé d'un appareil photo!", "OK", null);
    } 

I did this because Codename One blog stated

android.hardware.camera and android.permission.RECORD_AUDIO - com.codename1.Capture starts

However, when debugging an application with sources that I received from CN1 in Android Studio on a real device (API LEVEL 19 aka Kit Kat), I always got it java.lang.RuntimeException: Fail to connect to camera service.

, manifest.xml:

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

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

, , .

, ?

, , , ( Android Application Info) , . , , , Twitter " " , , , , .

20 2016 :

Android ,

. , , .

CN1 !

, CN1.

+4
2

:

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

cn1lib, .

+4

, , , . Android 6.0+ . , . , . , , .

, , : https://developer.android.com/training/permissions/requesting.html

- , .

+2

Source: https://habr.com/ru/post/1661309/


All Articles