Page 1 of 1

SOLVED: cameraControlDo doesn't work on Android

Posted: Sat Aug 05, 2017 9:50 pm
by simon.schvartzman
Hi, the code below (attached) works fine on iPhone but it doesn't on Android

I've tried with a device running Android 5.1.1 and another with Android 4.4.2 none of them load the picture.

What could be wrong?

Code: Select all

on mouseUp
         -- set the virtual camera
      cameraControlCreate"myFirstCamera"
      cameraControlSet "myFirstCamera", "device", "front"
      -- give time for the camera to settle
      wait for 3 seconds
      -- take the picture 
      cameraControlDo "myFirstCamera", "takePicture" 
      --answer the result
      put the result into img "Img1" 
      set the visible of img "Img1" to true
end mouseUp
Thanks

Re: cameraControlDo doesn't work on Android

Posted: Sun Aug 06, 2017 1:36 pm
by LiveCode_Panos
Hi Simon,

Have you checked the "Camera" permission is the Android Standalone Settings for the stack?

Best,
Panos
--

Re: cameraControlDo doesn't work on Android

Posted: Sun Aug 06, 2017 1:53 pm
by simon.schvartzman
Hi Panos, yes I had but it makes no difference:
panel.jpeg
Any other suggestion?

Re: cameraControlDo doesn't work on Android

Posted: Sun Aug 06, 2017 3:56 pm
by jacque
Camera is selected in the requirements for the device but it also needs to be selected in the permissions section at the bottom.

Re: cameraControlDo doesn't work on Android

Posted: Sun Aug 06, 2017 4:25 pm
by simon.schvartzman
Bingo! Many thanks Jacque you made my Sunday!

Re: SOLVED: cameraControlDo doesn't work on Android

Posted: Sun Aug 06, 2017 5:56 pm
by simon.schvartzman
For the sake of future users interested in the subject, besides Jacque's hint there is another trick needed to make the code above work on Android.

The "rect" settings of the camera have to be defined before taking the picture (on iPhone there is no such need according to my tests).

The final code will be:

Code: Select all

on mouseUp
   -- set the virtual camera
   cameraControlCreate"myFirstCamera"
   cameraControlSet "MyFirstCamera", "rect", "0,0,0,0"   -- it seems necessary on Android, on iPhone doesn't
   cameraControlSet "myFirstCamera", "device", "front"
   -- give time for the camera to settle
   wait for 3 seconds
   -- take the picture 
   cameraControlDo "myFirstCamera", "takePicture" 
   --answer the result
   put the result into img "Img1" 
   set the visible of img "Img1" to true
end mouseUp