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.

Android / I can't read level.dat on Android device.

Author
Message
halley
12
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 25th Sep 2012 11:26
in iOS and windows, I can use file functions to write or read files. but I can't on Android device. how should I do it?

The Miracrea Games
halley
12
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 25th Sep 2012 11:51
I put level files on Image folder, then the problem was solved. That's all. another question, I want to use different folder to contain different kinds of resources, such as images, sounds and musics. what need I do ? I only know agk::SetCurrentDir(), but it only can set one folder.

The Miracrea Games
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Sep 2012 16:59
Make your subdirectories under the assets/media one (assuming you are starting with that) and then use explicit path names in your file opening/closing. e.g.


In Tier 2 you don't have to use a media directory, all your media goes in the same directory as the app: Final for Windows, assets for Android and where you decide in your Xcode project.

I still use the media directory in my Tier 2 just for consistency and so that I can separate the media from the executable.

I've not had good experiences with the directory functions, so I avoid using them. I haven't tested them in Tier 2, but in Tier 1 the SetCurrentDir command kept creating strange path combinations (media/media/media) in my Documents directory (under AGK/<myproj>.

Cheers,
Ancient Lady
AGK Community Tester
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 28th Sep 2012 08:29
I do it like ancient lady and it works all the time.

Keep in mind also to only use small letters a,b,c,d and not A,B,C,D.

Android is case sensetive in many ways.

Android 2.3 Gingerbread , ZTE Skate , 480x800 , 800 mhz cpu , Samsung Galaxy Y , 240x320 , 832 mhz cpu
Android 4.0 Sandwich , Dmtech 3g 9738B , 1024x768 , 9.7 inches , cortex A8 1.2 cpu , 1 gb ram.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 28th Sep 2012 16:47
I have worked with the directory commands a little now.

If you look at my tests in this thread, you can see some of the results of what I found out.

Linux based OSs, like Android, are definitely case sensitive about directories and file names. You can have two files named 'This.txt' and 'this.txt' in the same directory. Something you cannot do in Windows.

Cheers,
Ancient Lady
AGK Community Tester
7RS
11
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 26th Dec 2012 18:45
Quote: "ldimg = agk::LoadImage("/media/somesub/somefile.png");"


The command work also for me but in t2 on android i use tinyxml to read the file we made with the map editor, "tiled" the tinyxml use the fopen and also if i try a simple fopen of a file i get error because the fopen seem to not found the file in the correct place.

How i can get the correct position of the file ? my files are all in asset/Media for the gfx and asset/ for the xml files

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 27th Dec 2012 10:10
7RS - see my reply in the general forum.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL

Login to post a reply

Server time is: 2024-04-19 21:49:13
Your offset time is: 2024-04-19 21:49:13