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.

Newcomers AppGameKit Corner / Do setfolder()/getfirstfolder()/getnextfolder() work on android?

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 15th Dec 2015 23:04 Edited at: 15th Dec 2015 23:10
I am using (AGK : Built on Geany 1.24.1)

my code looks like this;



this finds nothing (on android) even though there should be a folder in the directory
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 16th Dec 2015 23:26
I don't believe any of these commands work on Android.

I'm not entirely sure about the exact details but on Android, the app can only look in two areas both of which are locked away from the user. I've never even tried using folder commands on android as I don't need to mess about with folders, I just create what I need upfront and then I know what's there and what isn't when the app is running.

It's a bit frustrating as I'd like to make some level / character editors to put on my tablet but I can't easily access the data files that would be generated.
Invaders of the 29th Dimension - available now on Google Play
Find me on indieDB
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 17th Dec 2015 01:40 Edited at: 17th Dec 2015 01:41
From my experience;
SetFolder()/Getfirstfile()/GetNextFle() work (with the limitation of the read/write folders, reading from the "media" folder)

GetFirstFolder()/GetNextFolder() do not work (Folders ARE created by the APK though. When i hard code folder names it finds the files in those folders)

Not sure about the other functions. Haven't tried them

Quote: "It's a bit frustrating as I'd like to make some level / character editors to put on my tablet but I can't easily access the data files that would be generated."


Me too. I had a number of characters with various animations, so i wanted to put each character in a new folder. Then the program would automatically search the folders for new characters and add them to the game.
Can't see how i can do this now without creating some sort of index text file
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 17th Dec 2015 12:48
This code works from one of my apps. I have numerous themes, and I list them in a menu by checking which folders exist.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 17th Dec 2015 19:21
Did this work on Android? I know it works on Windows but it didn't work on android for me
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 17th Dec 2015 19:46
Yes, I ran it using the AppGameKit player on an Android phone (HTC 620, Android 4.4.4)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 17th Dec 2015 20:15 Edited at: 17th Dec 2015 20:17
i ran this on my samsung galaxy tablet (SM-T520) and it did not work
Android 4.4.2

Attachments

Login to view attachments
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 27th Jan 2016 16:07
To my experience, those commands will only work on files/folders inside the media folder on Android.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 27th Jan 2016 22:50
i have a test attached to that last post (folders.rar) if you want to test it on your android device

Sign up for NaGaCreMo!
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 28th Jan 2016 09:26
I think that you have to leave out the "/media", AppGameKit automatically checks the write folder and the read folder (read folder being media). So when checking folders, it is already in "/media" folder As far as I recall.
13/0
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 28th Jan 2016 10:44
no. no luck.
maybe you could download the .apk and try it on your android device?

Sign up for NaGaCreMo!
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 28th Jan 2016 14:43
Sorry, I remember now. When loading a media file (sound, graphics, music), it searches inside media folder. Try leaving out "/" in "/media". Oh, and Android file system is case-sensitive. So Media is not the same as media.
13/0
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 28th Jan 2016 20:30 Edited at: 28th Jan 2016 20:34
I have tried it a million different ways.
i would be lovely if you (or anyone) could just downloaded the example and just try it on your android device. it works fine on windows btw

Sign up for NaGaCreMo!
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 29th Jan 2016 10:19 Edited at: 29th Jan 2016 11:01
I tried your app, same result, then I looked in the help file for GetFirstFolder().

Quote: "Note that there is a known limitation on Android that any folders within the "assets" folder cannot be found using this command. You may be able to work around this by using MakeFolder to create the same folder structure in the write folder which AppGameKit can then use to find files in the assets folder with GetFirstFile."


EDIT: I have been messing with this for a while now, I can't get it to read a file I created in the folder "blue". I created a folder as suggested in the help file. I will try different stuff later and pack it as an APK to see if that makes any difference.
13/0
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 29th Jan 2016 22:13
Thank you very much. That clears up a lot of things.

Sign up for NaGaCreMo!
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 30th Jan 2016 09:07
Did you get it to read your folders in media?
13/0
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 30th Jan 2016 09:16
No. It doesn't work

Sign up for NaGaCreMo!
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 18th Feb 2016 17:18
Might be late, but if you want to read a different folder inside a folder, then you need to set up the folder for reading each time.

This is what Paul did to set up folders for correct reading from the intended folders:
The act of calling the SetFolder("") with an empty string is very important.
We had to call it whenever we want to set a new folder for reading.



Quote: "
We had to call the SetFolder("") with an empty string for the other commands to 'read' from the 'write' file.
By default the folder is set with SetFolder("/media") when the app starts running, so in this case GetFirstFolder() would be looking in E:\Temp\media.
If you are using other load commands then you can work around this by forcing the path to root by using LoadImage("/myimage.png") which will ignore the SetFolder part of the path. Or LoadImage("/media/myimage.png") to load it from the media folder whilst SetFolder is set to the empty string.

The GetFirstFile and GetFirstFolder commands collate results from both the read and write folder into a single list. In this case the write folder is listed first and then the read folder.
Duplicate file and folder names will only appear once in the list.
"

Login to post a reply

Server time is: 2024-04-19 20:00:07
Your offset time is: 2024-04-19 20:00:07