Android doesn't ask permission to use camera

The place to discuss anything and everything about running your LiveCode on Android

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
simon.schvartzman
Posts: 240
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Android doesn't ask permission to use camera

Post by simon.schvartzman » Wed Mar 06, 2019 4:35 pm

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
Simon
________________________________________
To ";" or not to ";" that is the question

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 550
Joined: Fri Feb 06, 2015 4:03 pm

Re: Android doesn't ask permission to use camera

Post by LiveCode_Panos » Thu Mar 07, 2019 9:48 am

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
--

simon.schvartzman
Posts: 240
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Android doesn't ask permission to use camera

Post by simon.schvartzman » Thu Mar 07, 2019 1:39 pm

Thanks Panos.
Simon
________________________________________
To ";" or not to ";" that is the question

simon.schvartzman
Posts: 240
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Android doesn't ask permission to use camera

Post by simon.schvartzman » Mon Mar 11, 2019 8:54 pm

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
Simon
________________________________________
To ";" or not to ";" that is the question

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 550
Joined: Fri Feb 06, 2015 4:03 pm

Re: Android doesn't ask permission to use camera

Post by LiveCode_Panos » Mon Mar 11, 2019 9:09 pm

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
--

simon.schvartzman
Posts: 240
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Android doesn't ask permission to use camera

Post by simon.schvartzman » Mon Mar 11, 2019 9:44 pm

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
Simon
________________________________________
To ";" or not to ";" that is the question

Post Reply

Return to “Android Deployment”