• 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 http_get return 0 and the returned string have IOException as value

O

osamara

Guest
hello all
I'm trying to find solution for this problem
i have http_get request to php page that will do some database job and return some info.

the code works fine on some devices
but on other devices it return 0; and
ds_map_find_value(async_load, "result"); have the value IOException

this is my code

GML:
if(global.enter_login_get==1)
{
if ds_map_find_value(async_load, "id") == get77
   {
      show_message_async(string(ds_map_find_value(async_load, "status")))
   if ds_map_find_value(async_load, "status") >= 0
      {
      r_str = ds_map_find_value(async_load, "result");
      show_message_async(r_str);
      if(r_str!="")
      {
                if(is_string(r_str))
      {
        d_map = json_decode(r_str);
        if(d_map != -1)
        {
        global.data_list_for_user = ds_map_find_value(d_map,"data");
        show_message_async(ds_map_find_value(d_map,"data"));
        //alarm[4] = 1;
        }
        else
        {
            
        }
      }
      }
      }
   else
      {
      r_str = "null";
      }
   }
global.enter_login_get = 0;
}
as i say it work fine on some devices and give this problem on others


any ideas why?
please i have a week struggling with this problem.
 

FrostyCat

Redemption Seeker
Check async_load[? "result"] only when async_load[? "status"] is exactly 0. For larger downloads, the HTTP event may fire several times with async_load[? "status"] set to 1 (for in-progress) where it does not have a result, before firing one final time with async_load[? "status"] set to 0 where it does have a result.

Part of the confusion dates from the GMS 1.x timeframe, when the behaviour silently changed from ">= 0 for success" to "0 for success and 1 for in-progress". This caught a lot of HTTP code off guard, and a number of tutorials didn't update to account for this. If you see async_load[? "status"] >= 0 in HTTP-dealing GML, it dates from GM:HTML5 or an early version of GMS 1.x, and is now unsafe. The current practice is to either check async_load[? "status"] == 0 explicitly, or handle the 1 and 0 cases separately.
 
Hey there,

I have the same Issue, but only on Android, on Windows the code runs without any problems:

if (ds_map_find_value(async_load, "id") == get_name_availability)
{
if (ds_map_find_value(async_load, "status") == 0)
{
text2 = string(ds_map_find_value(async_load, "result"));
show_debug_message("text2: " + string(text2));
}
}


text2 always has the output: IOException

I would appreciate any help :).
 
Top