AppGameKit Classic

AppGameKit Classic

DarkGriffin Aug 19, 2015 @ 11:04am
Android read/write location?
Anyone happen to know where Tier 1 saves data locally on the android device? Can a second app I make read data from the first one?

The Android SDK development docs say I should be saving my files to the user's "Public folder" in order to allow other apps, and the end user, to read the files and modify them.

The docs for AGK's open to write command just say, rather unhelpfully, "the local filesystem of the device". Thanks I guess. :p I have no idea what that actually means, as far as where files end up, or who can read them, per platform.
< >
Showing 1-8 of 8 comments
Android is Linux based so 'local filesystem" must be "/" I guess
Zwarteziel Aug 19, 2015 @ 9:34pm 
It's in a hidden location: Android/data/AppName/files

There has been some recent discussion about actually accessing and finding stuff in this thread[forum.thegamecreators.com].
DarkGriffin Aug 20, 2015 @ 8:31am 
Well crap. According to that thread, the only place AGK currently writes to is the internal private data.

Is there a way to force AGK to write to, say, the user's document folder?

I tried using Environment.getExternalStoragePublicDirectory() but the command does not exist in AGK. What's the equivilent? If there isn't one, I may be a bit stuck.

My game's success on android relies heavily on external content and the ability of the end user to edit and share said content between an editor app and a game player app, as well as cross that content(the level files) with the PC release of the game through USB copy/paste of the files.

But, if I cannot give user access to the files AT ALL, then any editing tools on the android devices are completely useless even if included in the game install. Uninstalling the game on android would delete the user's level files, and they can't see them on their device to "back them up" or "install another user's made levels".

I really hope there will be an update to allow AGK android apps to, at the very least, access the user's "documents/saves/yourAppNameHere" on their android storage as an alternate "root" directory. That would go a LONG way to making AGK's android exporting more useful.

To get around the android permissions, it could be a compile option when saving an android build, so that games that do not need it don't have the extra permissions on their installers.

For now, I guess I will focus on making a PC game/editor. But I will keep everything entirely mouse and edit field driven to future proof the design, in case the above facts change in an update to AGK. I was really hoping to be able to make the level editor on android, or at least let android users play PC user's levels made with the PC editor.
OK, so correct me but it seems I am about to set off in search of the same basic need?

I need to determine where the original install stores its data, so that at a later stage I can provide a download to add/replace files.

If I can't it means data upgrade of my original program has to include the whole program again and previous version should be scrubbed...euuch.

Seems like if I can determine this process, this would help you answer yours too?
DarkGriffin Sep 15, 2015 @ 8:04pm 
I really should be doing something else, so forgive me for the short version of how android OS installers work. Keep in mind it's linux based, with heavy permission locks:

An app from an apk installs to it's own install folder. This folder does not have permission to do anything but run.

An app with the same "key" will instead install "on top" of the existing install, this is how the apps, in the play store for example, can push an "update" to the app.

Due to not requesting any permissions by default, the only place an AGK game can write to is the "saved persistant app data" that every android app is given to use. Basically think of it as a special "my documents" folder only your app can access. Your app is also the ONLY app that can see this data, as the Android OS sorts these folders by keys(it's a bit more in depth, but that's as far as I know).

This second "save folder" is buried in the device memory, I don't use enough devices to know if there is a standard. My phone's location was in "appdata/some_hash_key_for_each_app/data files here". I know OUYA stores it somewhere else, though I have not poked it recently to remember the location.

For most uses, this setup should work well.

So long as you keep the same signed key on your app, existing users can install an update to the game that contains new levels/mechanics/code while new users will of course pull the whole fresh install. The installed app data does not overwrite the save directories as they are two seperate locations. So all the saved data from the "last install" is still there, and the new version can use it.

---

My personal issue is that I have two different apps(the editor is seperate from the game), and wanted to write the save to a more user friendly location.

I haven't found solutions from in the AGK tier 1 tools for either having two apps read the same data, or writing data elsewhere on the device. I think I'll have to break down and switch to tier 2 eventually so I can specify the android compiler options and request some write permissions in the installers.

I've done some restructuring of my plans for my game and the next version, and discovered quickly that making the new editor work on android or touch devices is much more work then I care to spend. So I'm settling for just making the editor work on PC for now. As a single man team, there's only so much "magic" I can pull off. :p

---

Anyway, hope the above info helps get you up to speed.

If you are technically minded, having a pour over the android sdk documentation on google's site can be a big help to understanding what the permission levels, and what persistant data, android apps have access to use. It actually works almost entirely like on windows when using AGK Tier 1, same read/write commands and everything. Pretty sweet.

Hope this helps. :)
hexgear Aug 29, 2016 @ 8:55pm 
@DarkGriffin:
Our games share a very similar concept in the sense that players can create their own levels (platform independent) and share it on the community website for others to download and play. I didn't encounter the problem you're having because in my case the level editor app and game player app are one and the same. From the main menu the player can decide to either play a level, download a level or create a level with the editor and upload.
hexgear Sep 9, 2016 @ 6:42am 
@DarkGriffin:
AppGameKit v2.0.21 has been released and can now solve this problem for you... at least for the Android Platform.

Originally posted by The AppGameKit Team:
Android Platform
- SetRawWritePath now works on Android, allowing you to set the write path to the public sdcard folder
- Changed GetDocumentsPath on Android to return the path to the public sdcard folder (which usually isn't an actual sdcard)

You can view the full list of fixes, tweaks and features Here[www.thegamecreators.com]
DarkGriffin Sep 9, 2016 @ 9:24pm 
Thanks for that info hexgear, and thanks The Game Creators for the update!

I'll probably restructure the game to have both the editor and player in one application, along with making use of that new setrawwritepath update to swap between my level data and user made data.

Other things in real life have me swamped right now. My AGK project needs large uninturrupted blocks of time, and life has been having other plans recently. But when I get the chance I'll be back to AGK and reevaluate my data structuring.

Best of luck with your project as well!
< >
Showing 1-8 of 8 comments
Per page: 1530 50

Date Posted: Aug 19, 2015 @ 11:04am
Posts: 8