• 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 Android Cloud Saving

D

Dxnxex

Guest
Hello,

I have some problems with Android CLOUD saving.
I don´t know too much about this, so I need your help.

First how does it work?

A = When you load your game and login to GOOGLE PLAY account a turn off internet will you be disconected from Google Play account and do you need to achievement_login() again?

B = If there is no internet connection, but I hit cloud save, it will save to Google Play and then after is internet connection available that will upload the file/string or that hit just done nothing?

Some code help. (How to check if it´s downloaded/uploaded)

C = I do have this in my code
Well I dont know if I need to do "First Cloud Save", because when I delete all files (Cloud, Local) and install game again I have error about Cloud data loaded, but data do not exists (data structure with index does not exist)

D = I have problem with checking if upload/upload was completed.

First I want to make that "First cloud save". If there is no "First Cloud save" do save it and #2 else make it #3
Code:
///Cloud Sync - First Cloud Save (Cloud Check String) #1

if ds_map_find_value(async_load, "id") == cloud_check_string {

    //Not Available CLOUD SERVICE
    if ds_map_find_value(async_load, "status") < 0
    {
        sc_cloud_text_console("Cloud Services not available")
    }
    
    
    else
    
    {
        if ds_map_find_value(async_load, "status") == 0{
        
            // Saving a file
            var data = ds_map_find_value(async_load, "resultString");
            Cloud_first_save = string(data);           
            
                //First Save
                if Cloud_first_save != Cloud_first_save_a {
                
                sc_cloud_save();
                sc_cloud_text_console("First Cloud Save");
                
                }
                
                else
                
                {
                
                sc_cloud_text_console("Loading Cloud Data");
                cloud_check_file = cloud_synchronise();
                
                }
        
            
        }
        
      
          
    } 
    
}

Then I want after it check if upload was completed do this:

I don´t know how async_load status == 3 works, becuase by the HELP (F1) it should work, when it´s DOWN/UP loaded this will active.

Code:
///Cloud Sync - Check First Cloud Save (Save Check String) #2

if ds_map_find_value(async_load, "id") == save_check_string {

    //Not Available CLOUD SERVICE
    if ds_map_find_value(async_load, "status") < 0
    {
        sc_cloud_text_console("Cloud Services not available")
    }   
   
    else
   
    {
        //Completed CLOUD Save
        if ds_map_find_value(async_load, "status") == 3 {
       
        sc_cloud_text_console("First Cloud Save Completed"); 
        sc_cloud_text_console("First Cloud Load In Progress"); 
        cloud_check_string = cloud_synchronise();
               
        }       
         
    }
   
   
   
   
   
   
   
}

Code:
///Cloud Sync (Cloud Check File) #3
if Cloud_first_save = Cloud_first_save_a {

if ds_map_find_value(async_load, "id") == cloud_check_file
{
    if ds_map_find_value(async_load, "status") < 0
    {
        sc_cloud_text_console("Cloud Services not available")
    }
    else
    {
        if ds_map_find_value(async_load, "status") == 0
        {
            // Saving a file
            var data = ds_map_find_value(async_load, "description");
           
            //show_message_async(data);
           
            var file =  file_text_open_write("dsmap_cloud.dat");
                        file_text_write_string(file, data);
                        file_text_close(file);
           
            Cloud_sync = 1;
            scr_dsmap_load();
           
        }
    }
}


}

Code:
if achievement_login_status() {

sc_cloud_text_console("Saving Cloud Data");
Cloud_first_save = Cloud_first_save_a;

save_check_string = cloud_string_save(Cloud_first_save,"Cloud_first_save"); 
sc_cloud_text_console("Saved STRING");

save_check_file = cloud_file_save("dsmap_cloud.dat","Cloud");         
sc_cloud_text_console("Saved FILE");
}


Thanks for help
 
Top