• 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!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Android Google cloud save

MagicHero

Member
Can anyone explain how to save and upload a file in google cloud?
Here is my save code for the test:
if achievement_login_status () {
var file = file_text_open_write ("dsmap.dat");
file_text_write_string (file, "1111111111");
file_text_writeln (file);
file_text_write_string (file, "2222222222");
file_text_writeln (file);
file_text_write_string (file, "3333333333");
file_text_writeln (file);
file_text_close (file);
cloud_file_save ("dsmap.dat", "game_save");
}

Here is the download:
In the button event:
cloud_check = cloud_synchronise ();
in Async - Cloud:
if ds_map_find_value (async_load, "id") == cloud_check
{
if ds_map_find_value (async_load, "status") <0
{
show_message_async ("Cloud Services not available.");
}
else
{
if ds_map_find_value (async_load, "status") == 0
{
var data = ds_map_find_value (async_load, "description");
show_message_async ("String loaded data:" + string (data));
var file = file_text_open_write ("dsmap.dat");
file_text_write_string (file, data);
file_text_close (file);
}
}
}
And if I check that in the file:
var file = file_text_open_read ("dsmap.dat");
text_1 = file_text_read_string (file);
file_text_readln (file);
text_2 = file_text_read_string (file);
file_text_readln (file);
text_3 = file_text_read_string (file);
file_text_readln (file);
file_text_close (file);
I will only get "game_save", i.e. what indicated in the "description" when saving.

If instead of "description" write "resultString" namely:

var data = ds_map_find_value (async_load, "resultString");
show_message_async ("String loaded data:" + string (data));
var file = file_text_open_write ("dsmap.dat");
file_text_write_string (file, data);
file_text_close (file);

That file will load correctly i.e. the instructions spelled incorrectly.

BUT HOW DO I DOWNLOAD A FILE WHERE INSIDE THERE IS SUCH (this is an archive of several files):

file.jpg

If i do as before, only "PK" is written in the new file. Is it possible to somehow read the file bytes from the cloud, or all of these characters, or just somehow copy the file itself?

P.S. I solved the problem and combined all my files into one without using the archiver. True, I had to tinker a lot. the files could have a different number of lines as well as the number of files themselves and part was .ini and part .txt, some had text in other numbers.
 
Last edited:
Top