Is it possible to retrieve INI files from an Android app made in GMS2 without rooting my phone?
I've been researching and it seems that, due to GMS2's sandboxed file-system, it is impossible to retrieve any files created by my app. I just figured I'd ask here, in case anyone has any leads.
If it helps, I am trying to design levels/areas for my unfinished PC game on my phone while I'm away from the computer, and then be able to grab my level/area files (which are stored as INIs), and transfer them to my PC for use when actually constructing my game world.
I've looked into using Google Drive, but no dice. The closest thing I've found is this solution given in this stack overflow answer (the first answer, using adb shell; I'd rather not back-up my entire phone every time I want to get this one INI file). However, my project is "not debuggable"-- if I could set it to "debuggable" mode, that would be ideal, but I can't figure it out. I did find this after a quick Google search, but I don't know how to change my app's "manifest file", whatever that is.
Thanks for any help!
EDIT: After many hours of work, I've found a work-around that works for me. I'll post my notes below for anyone else who might need them.
To transfer files over from the app, you must create a backup.ab file of your game's package.
Your package name is arbitrary and found in Game Options -> Android, and is in the form of:
"packagedomain.packagecompany.packageproduct", eg "com.mygamecompany.mygamename".
To create the backup, you must use a .jar file called "android-backup-extractor", which I have stored as
"C:\Android\android-backup-tookit\android-backup-extractor\android-backup-extractor-20180521-bin/abe.jar"
If it's not there, you can re-download it here:
https://sourceforge.net/projects/adbextractor/
----------------
NOTE!!! It may be wise to check if GameMaker Studio is creating an app with "allowBackup=false" in the
AndroidManifest.xml file. To change this setting, navigate to:
C:\ProgramData\GameMakerStudio2\Cache\runtimes\runtime-2.3.1.409\android\runner\ProjectFiles\src\main\
Once there, open the AndroidManifest.xml file in notepad, and find where it says 'android:allowBackup="false"'
and change it to "true". This will allow a normal backup to be created. Otherwise, an empty backup will be
created with nothing in it.
----------------
Then, run Command Prompt as an administrator.
Next, change directories (cd command) to where abe.jar is stored. For example:
cd C:\Android\android-backup-tookit\android-backup-extractor\android-backup-extractor-20180521-bin\
Next, create the app backup using the command:
adb backup -noapk com.your.packagename (ie, adb backup -noapk com.mygamecompany.mygamename)
On your Android device, allow the backup creation, and do not input a password. This will create a
new "backup.ab" file in the current directory (ie, the same directory as abe.jar).
Next, use this java command to convert the .ab file to a .tar file (swap backup.ab for whatever the backup's
filename is, and backup.tar to whatever you want the converted file to be named):
java -jar abe.jar unpack backup.ab backup.tar ""
Then, use 7-zip to extract the contents of the newly-created .tar file.
REFERENCES:
https://stackoverflow.com/questions/13006315/how-to-access-data-data-folder-in-android-device
https://stackoverflow.com/questions/2952140/android-how-to-mark-my-app-as-debuggable
https://stackoverflow.com/questions/18533567/how-to-extract-or-unpack-an-ab-file-android-backup-file
https://sourceforge.net/projects/adbextractor/
Posted Jan 26, 2021, 4:33 AM UTC · edited
An INI file is just a text file. Couldn’t you just type the data into any text editor on your phone and then transfer that into GMS?
Unfortunately, the clipboard functions only work in the Windows version of GMS2, not Android. Thanks though!
?
Functions like "clipboard_set_text()" etc don't work on Android. It was a good idea though, just not possible without extensions to GMS2 (which I found one, but it was $10, and I didn't want to pay for something so small that may or may not work).
Thankfully, I actually finally figured it out, and it took a lot of work and trial-and-error. I made an edit to the post if you're interested! It required messing with GMS's AndroidManifest.xml file, creating a backup of the app data and sending that to the PC, converting the backup, extracting the contents, and find the files. As for transferring files back to the phone? I'll save that for next time.
Anyway, thanks again for your help!