Taking a photo without native controls

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

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

GSA_DC
Posts: 35
Joined: Thu Nov 27, 2014 2:07 pm

Taking a photo without native controls

Post by GSA_DC » Thu Feb 11, 2016 7:08 pm

Hi.

I have a student who is developing a simple Android app and is wanting to take a photo without the user knowing (don't worry - it's part of an art school degree show installation about privacy - not a sleazy app for public deployment). I was wondering if it was possible to bypass the OS controls and have Livecode take a shot and store it. I'm thinking no but came here to confirm or be convinced otherwise.

Anyone know?

Kind regards, Paul.

rblackmore245
Posts: 67
Joined: Fri Jun 12, 2015 9:42 am

Re: Taking a photo without native controls

Post by rblackmore245 » Sun Feb 14, 2016 12:27 pm

No this isn't possible via livecode only way would be to use a third party app and launch it via livecode

peter-b
Posts: 182
Joined: Thu Nov 20, 2014 2:14 pm
Location: LiveCode Ltd.

Re: Taking a photo without native controls

Post by peter-b » Mon Feb 15, 2016 11:44 am

As far as I'm aware, both Android and iOS are very specifically designed for it to be difficult or impossible for an app to take a photo without the user being aware of it. I'd be curious to hear if you find a workaround -- and I expect Google/Apple would be quite interested too!
LiveCode Open Source Team — @PeterTBBrett — peter.brett@livecode.com

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Taking a photo without native controls

Post by LCNeil » Mon Feb 15, 2016 2:17 pm

A potential workaround would be to create an off screen camera view instance with LiveCodes

Code: Select all

cameraControlCreate
syntax and then take a picture via

Code: Select all

cameraControlDo "camerainstancehere", "takePicture
.

You could then setup and non-blocking send to take a picture at a specified interval (e.g. 5 seconds).

Please see the attached example which creates a camera control offscreen, take a picture every 5 secs and shows this image within an image control
camera.livecode.zip
(1.92 KiB) Downloaded 132 times
Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
--

Klaus
Posts: 11495
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Taking a photo without native controls

Post by Klaus » Mon Feb 15, 2016 8:05 pm

Hi Neil,

I just searched the 7.1 release notes for "camera" and nothing was found! :shock:

I was heavily astonished to read about this new command cameracontrol... here to say the least!
According to the dictionary it was introduced in 7.1!?

A little example on how this can be used on desktop system would also not be bad!

Something shocking new like this should be emphasized in 72 point textsize! :D


Best

KLaus

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Taking a photo without native controls

Post by LCNeil » Tue Feb 16, 2016 3:36 pm

Hi Klaus,

The documentation issues on the new Camera functionality are in our QC database and are waiting to be addressed. I agree that this is a great new addition to the LC platform and its a shame to see it not getting the love that it deserves :)

The syntax is the same across desktop/mobile (minus choosing the camera source of front/back) so the wee sample stack above should give you some leads with using the syntax.

With that being said, if I get the time I will create a short lesson on how to use the new syntax.

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
--

Klaus
Posts: 11495
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Taking a photo without native controls

Post by Klaus » Tue Feb 16, 2016 7:25 pm

Hi Neil,

OK, thank you!


Best

Klaus

GSA_DC
Posts: 35
Joined: Thu Nov 27, 2014 2:07 pm

Re: Taking a photo without native controls

Post by GSA_DC » Thu Feb 18, 2016 6:26 pm

Hello all.

Just caught up with this - a flurry of posts after a quiet first few days! Thanks to all involved.

Neil - thanks especially for the lead. I tried the code in 7.1.1 but couldn't get any response from the camera on the Android device. I ensured I had the camera Requirements and Restrictions all set to Required, and Application Permissions on for the camera. I rewrote the code a little to instance the camera control on the preLoadCard handler and have a single button to take picture. But still nothing. I tried running it on the desktop and it chokes not knowing what cameraControlCreate is.

There is absolutely no documentation I can find on these controls! Any pointers to any way to proceed appreciated. Thanks.

Kind regards, Paul.

rblackmore245
Posts: 67
Joined: Fri Jun 12, 2015 9:42 am

Re: Taking a photo without native controls

Post by rblackmore245 » Fri Feb 19, 2016 4:21 pm

I also could not get this function to work :o( tried on all versions up to the latest LiveCode 8.0.0 DP 14 and still no joy

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Taking a photo without native controls

Post by LCNeil » Fri Feb 19, 2016 4:27 pm

Hi all,

The new camera controls are commercial only so if you are using the community version of LiveCode they will not work.

If you are using a commercial version (indy etc), what scripts are you using to start up the camera? Do you have a sample stack I could test with

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
--

rblackmore245
Posts: 67
Joined: Fri Jun 12, 2015 9:42 am

Re: Taking a photo without native controls

Post by rblackmore245 » Fri Feb 19, 2016 5:14 pm

Hi Neil,

I wasn't aware there were extra functions in the commercial version of live code, that will explain why I could not get it to work.

GSA_DC
Posts: 35
Joined: Thu Nov 27, 2014 2:07 pm

Re: Taking a photo without native controls

Post by GSA_DC » Mon Feb 22, 2016 11:51 am

Thanks for getting back.

Ah - I see. Students here are using non-commercial version as you may imagine. I'll explain this important detail to the student. We have a total hack workaround triggering another machine to take a shot from a hidden camera.nBut it would be much tidier conceptually and operationally if it was done on the mobile device.

Kind regards, Paul.

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Taking a photo without native controls

Post by LCNeil » Mon Feb 22, 2016 1:46 pm

Hi Paul,

Our educational licence might be of interest-

https://livecode.com/products/livecode- ... education/

This will give you a single commercial licence that you could use to build your students standalones. This would give them the chance to try out out new camera syntax.

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
--

GSA_DC
Posts: 35
Joined: Thu Nov 27, 2014 2:07 pm

Re: Taking a photo without native controls

Post by GSA_DC » Mon Feb 22, 2016 3:30 pm

Thanks. This may be possible. I would need confirmation that this camera syntax works though to be able to access the money to buy the license. Perhaps I could send you the student's stack to check?

Another important issue is that the image would need to be saved on to the Android device's SD card. The Android device would be attached via USB to a MacMini. An application on the MacMini would access the saved images on the mounted SD card of the Android device, and use these images to display. Can you foresee any problems in this workflow?

Kind regards, Paul.

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

Re: Taking a photo without native controls

Post by simon.schvartzman » Thu Jan 19, 2017 1:11 am

HI, it is working OK for me on iOS 10 but I can't get the image saved to the Photo Album, I have added the mobileExportImageToAlbum command after taking the picture but it isn't saving. Not sure what am I doing wrong...any hint?

Code: Select all

on mouseUp
   cameraControlDo "myFirstCamera", "takePicture"
   put the result into image 1
   mobileExportImageToAlbum image 1
   --send "mouseUp" to me in 5 seconds
end mouseUp
Simon
________________________________________
To ";" or not to ";" that is the question

Post Reply

Return to “Android Deployment”