Page 1 of 1
Help needed saving snapshots on Android Device
Posted: Thu Aug 09, 2012 8:02 pm
by jlally
Hello,
I am trying to save out a snapshot of a rect to the "Pictures" directory of my physical Android device.
While I have gotten this to work in Livecode on my PC, I'm not having much luck on the Android device (specifically, a Kindle Fire).
Here is a snippet of the code I used for the (working) PC version:
put "C:/myPictureFolder/foo.jpg" into myExportFile
export snapshot from rect tRectSnap to file myExportFile as JPEG
Here is a snippet of the code I'm using for the (not working) Kindle Fire version:
export snapshot from rect tRectSnap to pictVariable as JPEG
mobileExportImageToAlbum pictVariable , "foo.jpg"
BTW, the Kindle code generates no errors - the JPEG is simply not saved to the Kindle's photo "Gallery".
Any help or suggestions on this would be greatly appreciated!
Thank you,
--John
Re: Help needed saving snapshots on Android Device
Posted: Fri Aug 10, 2012 1:29 pm
by Klaus
Hi John,
check the result directly after the export, this may give you a hint about what's going wrong:
...
export snapshot from rect tRectSnap to pictVariable as JPEG
mobileExportImageToAlbum pictVariable , "foo.jpg"
## the result is always EMPTY on success!
if the result <> empty then
answer "Error:" && the result
end if
...
Best
Klaus
Re: Help needed saving snapshots on Android Device
Posted: Fri Aug 10, 2012 8:10 pm
by jlally
Hi, Klaus -
Thanks for your quick reply! I just tried adding the new lines that you sent to me, and tried them out on my Kindle Fire.
Sadly, though, I'm still getting the same result - no error, and no new JPEG saved to my Gallery, either.
It does seem odd that it's not throwing *some* kind of error, though. I wish I knew more about the Kindle's directory structure - I'm thinking that I could use a modified version of my functioning PC code (which uses an absolute pathname) as a workaround, instead of the mobileExportImageToAlbum command.
Anyway, if you have any more suggestions or workarounds, I'd love to hear them!
Thanks again,
John
Re: Help needed saving snapshots on Android Device
Posted: Fri Aug 10, 2012 8:52 pm
by Klaus
Hi John,
AHA!
So you are just looking for a place to save your image to, right?
The best place is the users documents folder, call it like this, similar to the desktop syntax:
...
## You can also create a subfolder here if neccessary, we are allowed to write here!
put specialfolderpath("documents") & "/foo.jpg" into myExportFile
export snapshot from rect tRectSnap to file myExportFile as JPEG
...
Check the different supported "specialfolderpath"s in the "Android Release Notes" -> Livecode -> Menu: Help.
Best
Klaus
Re: Help needed saving snapshots on Android Device
Posted: Sat Aug 11, 2012 12:42 am
by jlally
Hi, Klaus -
Thanks, once again, for your quick response. And yes, that's all I've been trying to do - simply to find a valid place to save out a snapshot on the Kindle Fire (and then save the snapshot as a JPEG), as I've been able to do on my PC.
It would seem that my Kindle still does not want to cooperate, though. I tried implementing the code from your post (along with several other versions after reading the help page) and still, no luck!
I think the worst part is that the Kindle does not throw any errors; it gives no indication as to why my JPEG is not saving properly - it simply proceeds without saving.

There must be some little detail I'm missing, or perhaps something peculiar to the Kindle Fire...?
Anyway, I'm going to keep at it, and will post the answer if I find it. Meanwhile, if you have any more tricks up your sleeve, I'd be very happy to try them out!
Thanks again,
John
Re: Help needed saving snapshots on Android Device
Posted: Sat Aug 11, 2012 11:54 am
by Klaus
Hi John,
sorry, out of ideas...
The "specialfolderpath()" stuff is official and SHOULD work on ANDROID, and at least "the result" should give some info.
Best
Klaus