A little bit confused here. I have a project that adds permission to use the Camera via a library (target SDK 26 with B4A 8.30)
In Activity_Create of the B4A project I use inline Java code to check if the device has a front and back camera and also if a Flash is present.
But the above is executed successfully BEFORE I check and request the camera permission. I only ask for the camera permission when the START button is pressed to start the scanner.
If I don't check and ask for the camera permission in the B4A project (with target SDK 26) then the B4A app "errors - fail to connect to camera service". But it still executes the inline Java code and reports correctly on the ID's of the front and back cameras as well as the device having a flash - BEFORE the app crashes (because I have disabled the code to check for camera permission).
Can someone perhaps explain this observation?
Rgds
JS
B4X:
@Permissions(values={"android.permission.CAMERA".....
In Activity_Create of the B4A project I use inline Java code to check if the device has a front and back camera and also if a Flash is present.
B4X:
Log("ID of Front Facing Camera = " & nativeMe.RunMethod("getFrontFacingCamera", Null))
Log("ID of Back Facing Camera = " & nativeMe.RunMethod("getBackFacingCamera", Null))
Log("Device has a flash = " & nativeMe.RunMethod("hasFlash", Null))
If nativeMe.RunMethod("hasFlash", Null) = False Then
Log("does not have a flash")
End If
But the above is executed successfully BEFORE I check and request the camera permission. I only ask for the camera permission when the START button is pressed to start the scanner.
If I don't check and ask for the camera permission in the B4A project (with target SDK 26) then the B4A app "errors - fail to connect to camera service". But it still executes the inline Java code and reports correctly on the ID's of the front and back cameras as well as the device having a flash - BEFORE the app crashes (because I have disabled the code to check for camera permission).
Can someone perhaps explain this observation?
Rgds
JS
Last edited: