• 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!

SOLVED Async-HTTP throwing IOexception only on Android

Hello everyone,
I'm currently trying to convert my game from Windows to Android.


Firstly, the Name is checked by sending the information from the player:

GML:
function scr_get_name(argument0) {
    // Script:      Get the highscore list from the database in Altervista
    
    var name = string(argument0);
    var args = "name="+name+"&secret_key=*****************************";
    get_name_availability = http_post_string("*************************************", args);
}
Secondly, my game uses an online Database on Altervista with PHP code, where the name is checked:

PHP:
    // Connect to database
    $db = new PDO('mysql:host=localhost;dbname=*********', '*********');
    
    // Check secret key, if correct, then get name
    $secret_key = "******************";
    $name = $_POST['name'];
    $nameAvailable = 0;
    $further = true;
    
    $sql = "SELECT * FROM PlayerNames;";
    $stmt = $db->prepare($sql);
    $stmt->execute();

   if($secret_key == $_POST['secret_key'])
   {   
         while($row = $stmt->fetch(PDO::FETCH_ASSOC))
        {
            if($row['PlayerName'] == $name){
                $nameAvailable = 0;
                $further = false;
            } else {
                if ($further == true) {
                    $nameAvailable = 1;
                }
            }   
            
        }

        echo $nameAvailable;

    }

Lastly, my game catches the information again in an Http-async event:


GML:
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));
    }
}

And there is the problem, all the output from text2 I get is:

IOexception



Again, the weird thing is that this issue only seems to appear on Android, I tried it with several devices and the Android Studio Emulator.

Any help would be huge for me, thank you.
 

FrostyCat

Redemption Seeker
Is your target URL in plaintext HTTP (http://...)? If it is, either set up SSL on the server and switch to a secure HTTP URL (https://...), or temporarily enable plaintext HTTP permissions (be warned that the latter will disqualify you from Google Play if it contains personally-identiable information).
 
Thank you so much, I was sitting on this problem for so long now!!!
And also thanks for the hint with the SSL, the first thing I'm going to implement.

:)
 
Top