Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Save an image to the photo library (Android / iOS)?

Author
Message
Polaraul
9
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 8th Feb 2015 21:59
Is this possible in Tier 1? There seems no commands for returning the media directory of the device, and no way of setting this outside of the AppGameKit sandbox. Have I overlooked a command somewhere?
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 9th Feb 2015 04:44
It is possible just severely undocumented and still very restrictive. You can use PrintImage() and on iOS/Android it will save to the photo library. However, there is no way to supply a custom filename or save location, it simply auto-increments the name. I wish Paul would add a parameter to specify the filename at least. The function should actually be separated completely from PrintImage() in a new command like SaveToPhotoLibrary(imgId, imgName$)
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 9th Feb 2015 05:23
Quote: "I wish Paul would add a parameter to specify the filename at least."

Not sure if that's possible. I think, at least in iOS, any image you save gets renamed automatically. I know I've saved images from the web or email on my phone, but no matter what they have a generic name when I check the stored images.


"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 9th Feb 2015 05:56
Yeah I guess I was thinking more for Android. The previous incarnation of this functionality would save every single image as "printedimage" which meant only a single one would ever get saved on Android. Paul added the auto-increment at some point but it still seems like an easy parameter to add so it could be customized when supported by the OS.
Polaraul
9
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 9th Feb 2015 10:41 Edited at: 9th Feb 2015 10:42
Many thanks for all your help and time. Very disappointing and limiting that AppGameKit cannot save a user generated image to the photo library, especially since a ShowChooseImageScreen() command exists. Some apps need this functionality.

For now I will have to use PrintImage(), however, on the two Android devices I have tested this on the image is not saved to the photo library. I also have no control over naming convention, which looks less than professional in the final product. It does appear to be the only way though in Tier 1 to actually save a user generated image outside of the AppGameKit sandbox.
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 9th Feb 2015 19:40
Yes I have been after Paul to make that command more versatile for two years I think--as I had one app totally developed but could never release it due to this pitfall. I think on Android it gets saved to the memory card root directory under 'Pictures' which may not work on all devices.
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 9th Feb 2015 22:37
The printimage command doesn't refresh the gallery after the picture has been saved. In order for the image to show in the gallery you need to restart the android :/

Polaraul
9
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 9th Feb 2015 22:47
@xCept I may be in the same position. My project is almost complete, but I never thought that saving to the image folder (or even just saving a user generated image anywhere) would be an issue, specially since I had seen the ShowChooseImageScreen() command.
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 9th Feb 2015 23:13
Quote: "The printimage command doesn't refresh the gallery after the picture has been saved. In order for the image to show in the gallery you need to restart the android :/"

It has been a long time since I did native Android development, but I recall it was a simple 1-2 line method that had to be ran after saving an image in order to immediately update the gallery. This is something TGC should definitely look into.
Polaraul
9
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 10th Feb 2015 00:30
@=Prof= As you said, I restarted the device and all the user saved images now appear in the gallery. I guess I could release the app as is. The user does get notified of the save path, but I am sure most users would be expecting the image to appear in the gallery. It just doesn't feel very polished, but short of switching development platforms, I cannot see how this basic functionality can be achieved in Tier 1 AGK.
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 10th Feb 2015 15:37 Edited at: 10th Feb 2015 15:38
Quote: "It has been a long time since I did native Android development, but I recall it was a simple 1-2 line method that had to be ran after saving an image in order to immediately update the gallery. This is something TGC should definitely look into. "

Yeah, if it is that simple then a fix would surely be better than a reboot.

Quote: "The printimage command doesn't refresh the gallery after the picture has been saved. In order for the image to show in the gallery you need to restart the android :/"

Knowing a work around is great though, so glad to hear it's working, and for more than one at a time.
I guess notifying them that a reboot is necessary for those images to appear there is not so bad until there is a fix.
We can always update later.
Thanks =PRoF=


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
Polaraul
9
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 12th Feb 2015 13:09
It is good that at least the images will eventually show up in the users photo library, but with competition so fierce in the app world, it looks less than professional to have to tell a user to reboot their device to see those images. The competitors to my app don't suffer from such limitations, and I'm sure users of my app will just assume my app is bugged (which too all intents and purposes, it kind of is)

The limitations of the printimage() command has been mentioned here a few times by various users, and I really hope this gets addressed soon.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 12th Feb 2015 18:41
I had a look if the image could have a custom name but apparently this is not possible on iOS, and since Android and iOS should behave as similarly as possible then it was implemented the same way on Android.

I've not heard of needing to restart the device for the images to appear, it may be specific to that device, once the file is saved it's up to the Android OS and the photo app to refresh things.
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 12th Feb 2015 18:46 Edited at: 12th Feb 2015 18:48
@Paul, I believe this one line of code can be called from within the Android/Java environment to refresh the gallery after an image has been saved.



Otherwise I too have noticed the images do not update in the gallery on my test Android devices. Consider adding this to the AppGameKit runtime after the user calls PrintImage() on an Android device.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 12th Feb 2015 20:15
Thanks, that led me on the right path and I found this alternative that seems to be more widely supported

which I'll try out.
Polaraul
9
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 13th Feb 2015 16:24
Many thanks to Paul and all who posted with suggestions and ideas. It would be great if this issue was resolved in a future release.
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 23rd Feb 2015 22:01
Quote: "Thanks, that led me on the right path and I found this alternative that seems to be more widely supported ( CODE ) which I'll try out."


I have just incorporated this feature into my APP, which works really well on Android. It saves the picture and I like the way it auto increments the image file name so no messing has to be done in saving the image.
For me it is the same however, the image doesn't show in the folder on the Android device until it is rebooted.

Seems unprofessional on the APP at the minute even though it tells you where the picture is saved, it just leaves you thinking that the image has not been saved by the APP and therefore faulty.

Other than that it works great.

Quote: "MediaScannerConnection.scanFile(activity, new String[]{path}, null, null);"


@Paul
the above fix you seemed to have found, does it work and can it be updated as a quick fix update? instead of having to wait for a bunch of other updates to go with it.

Thanks.

Programming - AMOS on the AMIGA! / DBPro / Python / A bit of C C++ / now also AGK2! - Graphics - Deluxe Paint on the Amiga / Paintshop Pro / Photoshop / Lightroom / Grafx2
Previously worked for Prisma Software producing childrens educational software on the Amiga - Titles - Pepe's Garden - Paint Pot / Kids Academy range - Paint Pot II / Shopping Basket / Which Where What? / Blobs / Alvin's Puzzles
Polaraul
9
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 23rd Feb 2015 23:42
A quick fix soon for this would be very much appreciated.
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 15th Mar 2015 16:40
Quote: "Thanks, that led me on the right path and I found this alternative that seems to be more widely supported ( CODE ) which I'll try out."


Really quite eager to know whether you found a fix for this Paul and when it will be updated.

Cheers.

The Amiga and Amos were great!
Download my game - Paint Pot from Amazon and Google here - http://leap.my-free.website/
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 17th Mar 2015 00:23
Even if iOS does not let you specify a filename for saving photo gallery files, the print function can still take a filename parameter and this will only be used on android and ignore on iOs since no sdk can do that on iOS
Polaraul
9
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 17th Mar 2015 08:01
@bjadams The problem at the moment is that, although the PrintImage() will save an image, on Android it does not refresh the user gallery until they power cycle the device.

@spectrepaul Nothing has been said about this since, but like you, I am eager for this to be fixed. I've put my apps that use this command on hold for the time being.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 18th Mar 2015 22:03
people want to see the saved pictures in the gallery right there and then without rebooting. so this issue should be fixed asap. i think these are important features that make or break an app
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 18th Mar 2015 23:01
http://forum.thegamecreators.com/?m=forum_view&t=209073&b=41

I've been waiting for an update on this since December 2013 apparently...

SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 19th Mar 2015 00:34
Crikey I can't believe that, 2013 the problem was noticed

Well it looks like Paul has found a fix but I don't know how many more years before an update.

The Amiga and Amos were great!
Download my game - Paint Pot from Amazon and Google here - http://leap.my-free.website/
Polaraul
9
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 19th Mar 2015 07:54
Quote: " i think these are important features that make or break an app"


Agreed. My first app was an avatar creator, but asking the user to reboot their device for the generated avatar to show up, just feels like my app is bugged or broken (which, I guess it is)

The issue has been going on a long time now and I get the feeling that this function will never be fixed.

JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 19th Mar 2015 09:40
It doesn't take much to refresh it:

http://stackoverflow.com/questions/2170214/image-saved-to-sdcard-doesnt-appear-in-androids-gallery-app

<<It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.>> Dijkstra
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 19th Mar 2015 10:25
http://developer.android.com/reference/android/media/MediaScannerConnection.html

Yes it seems to be the MediaScannerConnection we need activating in tier 1. Not sure why it has been going on since 2013 though when Paul seems to have found a fix??

The Amiga and Amos were great!
Download my game - Paint Pot from Amazon and Google here - http://leap.my-free.website/
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 19th Mar 2015 10:30
Looking through the sendBroadcast commands seems to scan the whole SD card to refresh where as the MediaScannerConnection can scan the specific last file saved if you put the scan after the save/print image command.

@Paul, any update or confirmation that you have this fixed and just waiting to put in the update with the debugger??

The Amiga and Amos were great!
Download my game - Paint Pot from Amazon and Google here - http://leap.my-free.website/
Polaraul
9
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 20th Mar 2015 00:05 Edited at: 20th Mar 2015 00:34
@spectrepaul It may be worth asking over on the Steam forums too. I think those have a higher profile than here and usually elicit a response.

SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 20th Mar 2015 02:35
Done and awaiting reply here or there.

The Amiga and Amos were great!
Download my game - Paint Pot from Amazon and Google here - http://leap.my-free.website/
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 20th Mar 2015 03:06
Look my template on how to save photos on iOS.
On iOS you can't give a name to the photo, but is good in this way, so you can't hide software under a JPG.


SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 20th Mar 2015 03:14
I am tier one and Android as don't own a Mac unfortunately.
Your template is tier 2 I believe so not sure if that will work

I think when I get my first paid for app completed I will look at investing in a Macbook or Mac Mini to convert it to IOS and then see where things go from there.

I know you are a strong believer in IOS and maybe this is the way forward.

The Amiga and Amos were great!
Download my game - Paint Pot from Amazon and Google here - http://leap.my-free.website/

Login to post a reply

Server time is: 2024-04-18 22:12:53
Your offset time is: 2024-04-18 22:12:53