Page 1 of 1

Android doesn't ask permission to use camera

Posted: Wed Mar 06, 2019 4:35 pm
by simon.schvartzman
I have this App that requires Location and Camera. When the App is run for the first time it asks for Location permission but it never asks to allow the Camera to be used...(which results in user frustration and support questions)

This is the code I'm using to setup the Camera

Code: Select all

     cameraControlCreate "MyCamera"
      cameraControlSet "MyCamera", "device", "default"
      cameraControlSet "MyCamera", "rect", "0, 100, 320, 480"
      cameraControlSet "MyCamera", "visible", true
and this are my Standalone settings
Untitled 2.jpg
What am I missing? Or what can I do to overcome the issue?

Thanks

Re: Android doesn't ask permission to use camera

Posted: Thu Mar 07, 2019 9:48 am
by LiveCode_Panos
Hello Simon,

This is a bug. We had fixed this in LC 9.0.1, but the fix did not make it into 9.0.2 and 9.0.3 rc1.

As a workaround until we fix the problem in LC 9.0.3 rc2, add this line before creating the camera:

Code: Select all

androidRequestPermission "android.permission.CAMERA"
Kind regards,
Panos
--

Re: Android doesn't ask permission to use camera

Posted: Thu Mar 07, 2019 1:39 pm
by simon.schvartzman
Thanks Panos.

Re: Android doesn't ask permission to use camera

Posted: Mon Mar 11, 2019 8:54 pm
by simon.schvartzman
Hi Panos (et all) I'm facing the same problem now with "Write External Storage". User is never asked to allow permission. Same bug as with the Camera? How to fix it.

Thanks

Re: Android doesn't ask permission to use camera

Posted: Mon Mar 11, 2019 9:09 pm
by LiveCode_Panos
Hello Simon,

The external storage permission dialog is shown automatically if you call

Code: Select all

specialfolderpath("external storage")
in your code.

However, you can still "force" it to appear by using the code:

Code: Select all

androidRequestPermission "android.permission.WRITE_EXTERNAL_STORAGE"
Regards,
Panos
--

Re: Android doesn't ask permission to use camera

Posted: Mon Mar 11, 2019 9:44 pm
by simon.schvartzman
Panos, the problem appeared with the following code:

Code: Select all

export snapshot from group "Group 1" of card "Capture" with metadata theMetadataArray to tData as JPEG
        mobileExportImageToAlbum tData
I never declared specialfolderpath("external storage") because I don't need to. If the permission is not given then the image is not saved to the Android Gallery.

Your suggestion fixes the issue.

Thanks