Capture cam image for Android

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

ctp
Posts: 1
Joined: Thu Apr 14, 2011 10:57 am

Capture cam image for Android

Post by ctp » Thu Apr 14, 2011 11:00 am

Hi folks,

what's the easiest way to capture an image from the built-in cam by Android devices? Only found iPhonePickPhoto to capture iPhone's cam.

Cheerio,
Chris

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

Re: Capture cam image for Android

Post by Klaus » Thu Apr 14, 2011 11:05 am

Hio Chris,

no hint in the "Release Notes" for Android?
Maybe "iPhonePickPhoto" will also work on Android, althought the name does not suggest this?


Best

Klaus

mackus
Posts: 23
Joined: Thu Apr 22, 2010 12:17 am

Re: Capture cam image for Android

Post by mackus » Mon May 09, 2011 11:01 pm

its called mobilePickPhoto SOURCE with SOURCE being either,"library" , "album" or "camera" BUT I cannot get the native android camera app to open. I can open the album and return a picture to my imagetemplate but cannot get camera to work

any thoughts on that Klaus?

thx

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

Re: Capture cam image for Android

Post by Klaus » Tue May 10, 2011 1:36 pm

Hi mackus,

no, sorry, don't have a Android license/don't develop for Android.


Best

Klaus

Gene
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 75
Joined: Wed Mar 09, 2011 6:48 pm
Location: Northern California

Re: Capture cam image for Android

Post by Gene » Fri Jun 03, 2011 7:33 pm

ctp wrote:Hi folks,

what's the easiest way to capture an image from the built-in cam by Android devices? Only found iPhonePickPhoto to capture iPhone's cam.

Cheerio,
Chris
I have just started working toward the same goal, activating the native Android camera as written in the latest release notes. No luck yet, but I think I'll look at the equivalent syntax in the iOS notes.

You might want to be aware that there is now an Android topic in the "Platform Specific" section. This certainly an "Androcentric" question!

Gene

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

Re: Capture cam image for Android

Post by Klaus » Fri Jun 03, 2011 7:37 pm

Gene wrote:[...You might want to be aware that there is now an Android topic in the "Platform Specific" section. This certainly an "Androcentric" question!
Correct, I will move this thread to that section!

Best

Klaus

Gene
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 75
Joined: Wed Mar 09, 2011 6:48 pm
Location: Northern California

Re: Capture cam image for Android

Post by Gene » Sat Jun 04, 2011 6:01 pm

mackus wrote:its called mobilePickPhoto SOURCE with SOURCE being either,"library" , "album" or "camera" BUT I cannot get the native android camera app to open. I can open the album and return a picture to my imagetemplate but cannot get camera to work
Has anyone else worked on this problem and come up with anything?

I have had the same experience trying to make the camera work as mackus described, including being able to being able to successfully bring up the album and the library, but not the camera. In RevLessons, I found "How do I capture images in livecode mobile." The supplied code is supposed to work on both iOS and Android, with the exception noted (none of the code appears to contradict the Android 6.1.1 release notes):

"on mouseUp
# the X, Y dimensions for an image are not supported on Android and are ignored
mobilePickPhoto "camera", 212, 122
if the result is text then
put the result into image "The_Image"
else
put the result into field "The_Result"
end if
end mouseUp"

Just as mackus experienced, "library" and "album" in the source appears to work just fine. However, anything to do with the camera (for me) immediately causes a force close on my device, a Samsung Captivate running Froyo 2.2.1. This phone isn't 1st generation, but it has been a robust little beast that has digested a lot of programs downloaded from the market that others have said force closed their machines, so I'm loath to blame the phone right off.

If no one has anything to add, I'm going to submit this as a bug report. Going out on a limb here, I'm going to say that, without the capability to render video, or the capability to capture images, most of what you left for smartphones is pretty much various elaborations on "Hello World" (somebody ought to take the bait on that one! :D ). In any case, I would be very glad to see this particular issue resolved, even if it's something I'm doing wrong.

Cheers!

Gene

BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Re: Capture cam image for Android

Post by BarrySumpter » Thu Jun 23, 2011 3:37 am

-
Last edited by BarrySumpter on Sun Sep 11, 2011 9:47 pm, edited 5 times in total.
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

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

Re: Capture cam image for Android

Post by Klaus » Thu Jun 23, 2011 12:24 pm

Hi Barry,

wrong syntax!

Please check my comments:

Code: Select all

on mouseUp
   # the X, Y dimensions for an image are not supported on Android and are ignored
   ## If this is the case then you should bug report it!

   mobilePickPhoto "camera", 212, 122
   ## This will create a NEW image on the current card
   ## THE RESULT will be empty on success and contain the error string if not
   if the result <> empty then
    ## NO success
    answer "Error! && the result
    exit mouseup
  end if

  ## Now do what you need with LAST image, e.g.
  put last img into img "my placeholder for imported images"
  delete last img
end mouseUp
You can set a lot of properties for the newly created image BEFORE it is created:
...
set the visible of the templateimage to false
set the loc of the templateimage to 100,100
set the name of the templateimage to "Harry"
### etc...
mobilePickPhoto "camera", 212, 122
...
You get the picture (image) :D


Best

Klaus

BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Re: Capture cam image for Android

Post by BarrySumpter » Thu Jun 23, 2011 3:08 pm

-
Last edited by BarrySumpter on Sun Sep 11, 2011 9:49 pm, edited 4 times in total.
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7237
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Capture cam image for Android

Post by jacque » Thu Jun 23, 2011 6:01 pm

RR does test everything before release. Naturally a few things slip past, but I've found the engine to be very reliable. The image and imagetemplate syntax have been in the engine since version 1.0, which makes it about 15 years old, so it's been very well tested. But there's a learning curve for newcomers which can make LiveCode seem "flaky", and there are so many features available, the curve can seem pretty steep sometimes. I really do understand the frustrataion -- every single one of us has gone through it. It's the most common reaction especially from anyone coming from a different language. But after a while it will become second nature and things will fall into place. Just keep at it, I think you'll be surprised. Once that "eureka" moment hits, it's smooth sailing.

Klaus' code should work, give it a try. That approach sets all the properties of the templateimage before you get any real photos. But you should also be able to set properties after the image is imported if you want to.

Default behavior is to resize the image object to the size of the image you put into it. If you don't want that to happen (i.e., you don't want a full-screen image) then lock the location of the image object before doing anything with it. That will prevent resizing.

I wouldn't use "the result" syntax that's used in your posted example code. I'm not sure what that was trying to do, but it doesn't seem to apply to your goal.

Finally, we're here when you get that sinking feeling. Just holler.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Re: Capture cam image for Android

Post by BarrySumpter » Thu Jun 23, 2011 10:40 pm

-
Last edited by BarrySumpter on Sun Sep 11, 2011 9:48 pm, edited 1 time in total.
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Re: Capture cam image for Android

Post by BarrySumpter » Thu Jun 23, 2011 10:57 pm

-
Last edited by BarrySumpter on Sun Sep 11, 2011 9:48 pm, edited 1 time in total.
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Re: Capture cam image for Android

Post by BarrySumpter » Thu Jun 23, 2011 11:46 pm

-
Last edited by BarrySumpter on Sun Sep 11, 2011 9:48 pm, edited 2 times in total.
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7237
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Capture cam image for Android

Post by jacque » Thu Jun 23, 2011 11:51 pm

I'd say you're batting 1000, everything you report is a legitimate glitch. Don't doubt yourself. :)

The file name save-as is something I guess we've all gotten used to. For now, it's been left that way in favor of fixing more pressing issues. After a while you forget to notice I guess.

I missed the discussion on the Apply button. "Apply" feels pretty straightforward to me and seems to work as intended. Can you point me to the forum discussion where I can catch up on the problem?

I've very occasionally seen the glitch where the script editor warns that you've edited a script in a different app. I don't use an external editor, so the message is always in error. It almost never happens to me, so I haven't figured out a recipe to reproduce it. If you have one, let me know and I'll report it. It's a bug.

The "Close and remove from memory" dialog is, I think, intended to be a confirmation of intent rather than a check for whether the stack has been saved or not. The info about how you'll lose everything since the last save is an addendum but not the main point of the dialog. That said, it's irritated me for a long time and I mildly resent the extra click. So I just bug-reported it. Hopefully they'll change the behavior, which I think was intentional but not well thought through.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Android Deployment”