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 / OpenToRead issue on Android 4.X

Author
Message
SolusHunter
13
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 9th Aug 2013 13:47 Edited at: 9th Aug 2013 17:39
I've compiled my app via the online compiler (AGK 108 b17) and tried this out on 2 different android devices.

Basically when I attempt to save settings using the OpenToWrite command and then reload them using OpenToRead nothing seems to happen.

On Windows the files are written correctly and a setting such as turning music off is maintained across runs; but on Android 4.2 the file is ignored and the internal file (media folder) is used instead.



I also performed a file search on my android tablet and it didn't find the file I was writing to.

DarkBasic Pro 7.7 U77RC7 - AppGameKit 107
Windows 7 x64
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 9th Aug 2013 21:36
@solushunter,

Are you changing the directory at any point? By default agk saves to a seperatete media folder in its reserved write area, and windows will save to a folder in your "my documents/agk/your project name/media" folder. If you want to save anywhere else, use setfolder("") to reset to the root, then if needed again for each other folder. So if you want it in a settings folder outside of the media folder, use setfolder("") followed by setfolder("settings"). Note, on windows you can enter the entire file path in one go, but with android it's best to do it step by step.
SolusHunter
13
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 10th Aug 2013 12:12
I haven't changed the directory at any point in my game. The code snippet I posted in the original post is the entirety of the code I'm using to load and save the few settings I need.

On Windows it works absolutely perfectly.

On Android 4.2 it loads the file from the media folder (defaults) but never saves or loads from the special app folder - wherever that is (I haven't been able to locate it on my Android tablet).

DarkBasic Pro 7.7 U77RC7 - AppGameKit 107
Windows 7 x64
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 10th Aug 2013 13:45
Have you looked at the Android manifest to see if it has write permissions enabled?

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
SolusHunter
13
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 10th Aug 2013 14:42
Where would I find that?

According to my tablet the app has the following permissions:

modify or delete contents of the SD Card
full network access
view network connections
prevent tablet from sleeping
test access to protected storage

DarkBasic Pro 7.7 U77RC7 - AppGameKit 107
Windows 7 x64
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 10th Aug 2013 14:46
Stupid question - have you got an SD Card in?

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
SolusHunter
13
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 10th Aug 2013 15:03
Yes, there is an SD Card in the tablet

DarkBasic Pro 7.7 U77RC7 - AppGameKit 107
Windows 7 x64
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 11th Aug 2013 13:20 Edited at: 11th Aug 2013 13:21
Another stupid question, this isn't just as broadcasting is it, and it's an actual installed apk? I save dozens and dozens of settings and never have an issue. Instead of writeline and readline, try using writestring and readstring instead. And just in case, leave the file extension as ".txt" as well (as you said, no one will find it anyway, shod be quite safe lol). On my mobile now, but I'll try your exact code later if you still get no luck.

EDIT: I just realised you said it was compiled, ignore the question about broadcasting. Lol.
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 11th Aug 2013 20:41 Edited at: 11th Aug 2013 20:43
@SolusHunter

Ok, I've recreated your code and built the attached APK with the AppGameKit deployment page on their site, but I've been unable to produce the same issue you are having on two separate android devices, an Archos tablet (4.0) and a Samsung galaxy note 2 (android 4.2). Try the attached .apk - the first time it is run is should show all settings as zero and say "CLICK TO SAVE AND RELOAD", and when you touch the screen it loads some default created settings. On each subsequent run it will load the settings it creates on it's first run, and should say so. (It's a very quick job and you may need to force close the app as it's not coded to end normally, depends on the device).

I had to fill out your code a bit, but below is exactly what I used:



Not 100% what issue you are having, but if the attached apk doesn't work as I've specified then it must be your particular device, in which case Paul may want a catlog of it running or something. If the attached does work, and that doesn't help you solve the issue, you'll need to post more code as the issue you have must lay elsewhere in your code (or perhaps even your compiler is corrupted?).

Attachments

Login to view attachments
SolusHunter
13
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 11th Aug 2013 20:46
Your test APK worked!

I will have to investigate why my code isn't working properly.

Thanks for the help.

DarkBasic Pro 7.7 U77RC7 - AppGameKit 107
Windows 7 x64
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 11th Aug 2013 21:05
No problem, I've had my share of headaches with file handling on android.
SolusHunter
13
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 12th Aug 2013 11:55
Well, I still can't find a reason why my save file isn't saving. I even removed the default file from my media folder and saved if the file doesn't exist, then reloading and it still doesn't find the file:



I tried to locate the folder that AppGameKit is supposed to create for the app (Android/data/data/com.yourapp/) and I can't even find that.

In fact with Santman's test APK I can;t find the folder for that app either.

DarkBasic Pro 7.7 U77RC7 - AppGameKit 107
Windows 7 x64
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 12th Aug 2013 13:24
Maybe this is a good time to try a fresh install of agk just in case, it's a quick and easy check to do.

If you want you can email me an apk that isn't working for you, and I'll let you know if it fails for me too.
SolusHunter
13
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 12th Aug 2013 13:57
Actually that's a good point. What version of AppGameKit are you using? I built mine with 108 beta 17.

DarkBasic Pro 7.7 U77RC7 - AppGameKit 107
Windows 7 x64
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 12th Aug 2013 15:14
Ah, I never went to 17, still using 15 as it's stable for my needs.
SolusHunter
13
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 12th Aug 2013 16:41
Sounds like something went wrong in beta 17 then. Is there anyway to download previous beta versions?

And can I post a bug report?

DarkBasic Pro 7.7 U77RC7 - AppGameKit 107
Windows 7 x64
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 12th Aug 2013 19:19
I have all the betas bar 16 and 17,but they are too big to upload here. I'll install 17 tonight and if the problem appears I'll fire it in the beta 17 post.
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 12th Aug 2013 20:41
@Solushunter,

Nope, I'm afraid I installed and built an apk with beta 17 and it;s still working fine, attached here.

Really not sure what's going wrong, but if this works it's got to be something at your computers end I'm afraid.

Attachments

Login to view attachments
SolusHunter
13
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 13th Aug 2013 10:05
OK, thanks for checking. I'll try a fresh install of AppGameKit 108.17 and see what happens.

DarkBasic Pro 7.7 U77RC7 - AppGameKit 107
Windows 7 x64
SolusHunter
13
Years of Service
User Offline
Joined: 18th May 2011
Location: Kent, United Kingdom
Posted: 13th Aug 2013 11:10
A fresh install has resolved the issue - for some strange reason!

Thanks for all your patience and help.

DarkBasic Pro 7.7 U77RC7 - AppGameKit 107
Windows 7 x64
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 13th Aug 2013 11:27
No worries, just glad you got it working. I can only imagine how frustrated you must have been. Lol.

If you hadn't already, you'd best edit out your report on the beta 17 thread too.

Login to post a reply

Server time is: 2024-11-24 17:59:22
Your offset time is: 2024-11-24 17:59:22