MobilePickPhoto Error

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
JacobS
Posts: 58
Joined: Mon Aug 20, 2012 8:41 pm

MobilePickPhoto Error

Post by JacobS » Mon Aug 20, 2012 8:57 pm

Hello All,

While using the command MobilePickPhoto "camera" on my Android Devices, I experienced: "Error: could not create temporary image file". I have searched the forums and the broader web and it seems like no one else has run into this problem.
I am using LC 5.5.1 and my Android Devices are the Samsung Galaxy Tab 2 and the Samsung Stealth V.

Here is my code that I am calling:

Code: Select all

on mouseUp
   set the name of the templateimage to "DataEntry"
   set the width of the templateimage to 240 
   set the height of the templateimage to 320 
   set the visible of the templateimage to false
   if exists(img "DataEntry") then
      delete img "DataEntry"
   end if 
   
   mobilePickPhoto "camera"
   answer the result
   if exists(image "DataEntry") then
      set the width of image "DataEntry" to tWidth
      set the height of image "DataEntry" to tHeight
      put "" into picData
      put base64encode(image "DataEntry") into picData
      set the cPicData of this card to picData
      
      --Now change the appearance of the btn so the user knows that a picture has been taken
      set the backgroundcolor of me to 0,255,0
   end if
end mouseUp
So every time the 'answer the result' line is encountered, the error shows up.

Any ideas? Thanks.

Jacob

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: MobilePickPhoto Error

Post by Dixie » Mon Aug 20, 2012 9:25 pm

Hi...

Code: Select all

on mouseDown
   set the loc of the templateimage to -1000,-1000
   mobilePickPhoto "rear camera", 320,460
   if the result is empty then
      set the text of image "thePhoto" to the last image of this card
      set the visible of image "thePhoto" to true
      wait 0 millisecs with messages
      delete the last image of this card
      set the defaultfolder to specialfolderpath("documents")
      export image "thePhoto" to URL("binfile:" & "./" & "tempic" ) as PNG
   end if
end mouseDown
This might hekp you...

be well

Dixie

JacobS
Posts: 58
Joined: Mon Aug 20, 2012 8:41 pm

Re: MobilePickPhoto Error

Post by JacobS » Tue Aug 21, 2012 2:05 pm

Thanks for the quick response, but it still gives me the same error: "Could not create temporary image file."

After that, I tried your code in a new stack that contained only 1 button and the image "thePhoto", and it worked! But when I paste the code that works into my app that I want the picture-taking capabilities in, it doesn't work. I'm at a loss as to what to do next. Even after resetting the templateimage right before your code, it still doesn't work.

Or is there some property of the templateImage that would make it not compatible with the picture-taking app on the device? Or could something I did earlier in the app be preventing it from creating a temporary image?

Thanks again.

Jacob

JacobS
Posts: 58
Joined: Mon Aug 20, 2012 8:41 pm

Solved - MobilePickPhoto Error

Post by JacobS » Tue Aug 21, 2012 2:29 pm

Solved!

After checking the Standalone Application settings, I realized that I did not have the "Write External Storage" permission checkbox checked. After checking it, mobilePickPhoto now works. I guess I didn't realize that creating a temporary image involved external storage.

Thanks for your help,

Jacob

Post Reply