• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android Screen_save, file_text_open_write not working on build project

W

Wraithious

Guest
Android export module
So if I build my project APK and run it, when I save a screenshot, either using screen_save or screen_save_part it doesn't save anything, also won't save even a text file, but if i compile the game and test it it works fine, any sugestions?
some info:
I have 2 extensions in my project, one for bringing up text and one for bringing up media files (which the 2nd extension doesnt work but that's another problem)
Im using gamemaker studio early access v1.99.493
tried cleaning project and save project, and force stop in app on phone and deleted app from phone after that and then build project
also noticed if i install the app from downloading the apk from my computer it says "no special permissions are required, install?" but I have WRITE_EXTERNAL, BLUETOOTH, and INTERNET checked in android tab of game preferences.

the code is pretty simple so I'll post it:
in alarm event:
Code:
global.savename="Roadhammer Gaming\Mergery\"+global.str4+string(global.namenum)+".png";
screen_save_part(global.savename,(global.xboarder),(global.yboarder),(global.xfarboarder-global.xboarder),(global.yfarboarder-global.yboarder));
smypic2=file_text_open_write("Roadhammer Gaming\Mergery\pic_numb2.txt");
file_text_write_real(smypic2,global.namenum);
file_text_close(smypic2);
smyname=file_text_open_write("Roadhammer Gaming\Mergery\Creation.txt");
file_text_write_string(smyname,global.savename);
file_text_close(smyname);
global.namenum+=1;
when I only compile it, (it works fine) this is the address saved in the text file
Creation.txt:
Roadhammer Gaming\Mergery\test0.png

If I build my game, I put a check in there to display what the text file would tell me if it created it, I get the exact same thing, only displayed on screen: Roadhammer Gaming\Mergery\test0.png so I don't understand what is wrong here unless the extensions I downloaded are somehow interfering, If I have to I'll delete them to test it that way but i really dont want to do that if it's only something I'm doing wrong
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
So, your code works, but only if you create a custom APK by compiling it as if for the store? If that's the case then I would think that it's because the testing process uses the YYG runner, while compiling creates a custom runner. When testing, try adding working_directory + into the file path and see if that points GMS t the correct location (on compile it's obviously not necessary). Also test using the YYC module rather than the regular one and see if that gives different results as that doesn't use the runner at all.

Code:
global.savename = working_directory + "\Roadhammer Gaming\Mergery\"+global.str4+string(global.namenum)+".png";
 
W

Wraithious

Guest
@Nocturne ,
hmmm still the same, if i compile to test (by clicking the green arrow), it works, if i build the project (final release that makes the apk) it doesn't work, i tried it on the android/fire yyc runner and it's the same thing, i messed around with the slashes and tried it all the following ways:
"\Roadhammer Gaming\Mergery\"+global.str4+string(global.namenum)+".png";
working_directory + "Roadhammer Gaming\Mergery\"+global.str4+string(global.namenum)+".png";
working_directory + "Roadhammer Gaming/Mergery/"+global.str4+string(global.namenum)+".png";
working_directory + "\Roadhammer Gaming\Mergery\"+global.str4+string(global.namenum)+".png";
working_directory + "/Roadhammer Gaming/Mergery/"+global.str4+string(global.namenum)+".png";
working_directory + "\Roadhammer Gaming/Mergery/"+global.str4+string(global.namenum)+".png";
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Ah, okay, I thought it was the reverse... the truth is that you should never need to use working directory and I was just testing a theory... Not sure why it works on test and not on compile then. :(
 
W

Wraithious

Guest
So does anyone have any more ideas on this? I even tried a clean install of game maker early access with no luck so I'm guessing it has to do with the sandbox thing, when the screenshot is "taken" the screen blinks sugesting that it saved it somewhere, but my phone isn't rooted so I cant look for it. Currently I'm trying to make my second extension (my first try ended in utter failure lol) but it will bring up all image folders then you can pick a folder to save to, android is so frustrating, this all works perfectly in windows
 
Top