Get request with smartphone

Hello all,
I wrote a game. It call a web service with GET call.
During the preview it works correctly ( I made a lot of test).
Then I generated the APK file, installated it. The game works but the web call not.
I suppose that the app need network authorization but I don’t know how to set them.
Can you please help me ?
( the smartphone is online, of course)
I am using the same WiFi network.

Thanks,
J

Hi,
What Android version is the phone?
I don’t think a permission is required, since there is Admob and more…

did you ever get called get mobile?

Hello all,
I have generated a simple example:

If I run it on preview it works perfectly but if I compile it and run on my smartphone, the web page request failed: the raw scene variable is empty ( the smartphone is online and on the same WiFi than the PC).
I tested also generating Windows executable file and it works. It failed only on Smartphone.

Any idea ?

According to javascript - XMLHttpRequest POST not working? - Stack Overflow, you need to add

<access origin="*" />

To your config.xml. You can modify it while exporting if you are exporting manually or modify the one in the subfolder resources/GDJS/Runtime/Cordova of your GDevelop installation directory for it to affect all rpojects and exports (might reset when updating GDevelop).

Hello Arthuro555,
thanks for your help.

I checked the file (it is the first time that I open it) with notepad.

I found:

I suppose it is already setted.

To generate apk I use the Gdevelop

In your link I read to modify: AndroidManifest.xml but I can’t find it.

Any other idea ?

Please, can someone tell me if it is possible to call an internet service from a GDevelop APK app ?
If the answer is no, I suggest to show a popup advise when the action is inserted in the editor.

Thanks a lot.

I never tried. It would be easier if you shared your example project :slight_smile:
Maybe you should try a public file instead of dreamlo which might require a logging? I don’t know it.

Hello Gruk,
and thanks for your help.

You can call teh service without locgout.
The call used in my simple example is:
http://dreamlo.com/lb/5ecc197f377dce0a1438dd01/json

And the code source:
https://we.tl/t-VyFLSG2QCY

I suppose that the apk app isn’t able to go in internet. but I don’t konw how to fix it.

Thanks,
J

1 Like

Hi everyone,
I know I’m boring, but from my point of view it’s very important to know if GDevelop can generate a mobile app that can go online or not.
Nobody has an answer?
If not, I suggest showing a popup that warns you by entering the web call: I think it is very important to know this limit when developing the game.

Thanks,
J
Thanks,
J

Hi,
I tested your project.
It works on PC, it works on mobile on network preview, and it works as exported APK.
I’m on Android 8, on home wifi.
Do you have a safety software on your phone, antivirus or other, that could block the request? Shouldn’t block a GET, but who knows…

Thanks a lot for your help Gruk, you are always very kind and helpful.

It’s a very curios case.

I tried to generate the apk with https://build.phonegap.com/ service and … it works (it should be the workaround).
So I know that:
isn’t my program problem
isn’t my phone problem

I can suppose that the problem born during the GD apk generation.
What tool do you use to create the app ? The GD standard one ? Do you change any setting before the apk generation ?

Thanks,
J

I exported using the standard online build.
The only thing I did was open the action to see the parameters, and I added empty quotes to the type because the syntax checker turned it red when I clicked on it.
image
Maybe that’s the bug. Confirm on your side.

Hello Gruk, thanks for your help.

I fixed the code inserting “” it but it doesn’t work.

So, a summary:

  • the preview and the others compiled programs work correctly
  • generating the apk with https://build.phonegap.com/ service: it works correctly
  • the same project compiled in a different GD installation works correctly;

I can assume it’s my GD installation setting. As soon as I tried to install it on a different PC and I will let you know.

Thanks,
J