AJAX Request on mobile only works when wifi is available?

  • As the title reads, I'm retrieving my highscore table from a php file on my webserver, and it doesn't work when the player does not have wifi. Any ideas what the problem could be?

  • You need wifi to connect to internet to fetch the file which is on your webserver which is online, and can't be accessed without an internet connection. Anything shipped with game is offline. Anything external requires internet.

  • But we still have 4G and LTE. Why can't my game utilize this technology?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I know mobile can either disable 3g/4g completely to avoid costs, also, did the On error trigger?

  • I made sure the 3g/4g wasn't disabled. The app is already out, and only my friends who have crappy wifi have this problem. It may be related to the leaderboard php code, but I'm not sure. If I upload it can you take a look?

    Edit: I reread all of the code, and added error messages for every failed if statement...however no data is returning. This leads me to believe that the AJAX plugin doesn't work on mobile. I'm using AJAX RSA plugin, for the encryption.

  • AJAX does work on mobile

    Okay pulling at straws...

    Have you tried adding this to your php file

    header('Access-Control-Allow-Origin: *');[/code:938vkh7y]
    You also need to check  cross-domain security restrictions
    Read about it [url=https://www.scirra.com/manual/107/ajax]here[/url]
    
    Some phones "I think" can block fetching data for security reasons. I'm really not very clued up on mobile security settings.
    But if it works on wifi, which i know it does. It also works on my 3g, but I've set my phone to use either wifi(when available) or 3g so it always has access to internet. Some apps I have turned off 3g to save $$ so it could be users mobile settings.
  • I already have that header in the php file, and my cellular data for my app is turned on in settings. This is on iphone btw.

  • I already have that header in the php file, and my cellular data for my app is turned on in settings. This is on iphone btw.

    You used cocoonjs to port to iOS I presume. It wouldn't surprise me at all to find the issue is there.

    I haven't done a iphone app in awhile because cocoonjs isn't an option, has never been.

    I presume the preview worked fine... therefore the issue is with cocoonjs (if you used it)

    Sorry, I haven't a clue.

  • AJAX should work fine over cell data connections. There is absolutely nothing different you need to do as a developer, everything is handled by the OS. However cell data connections can be really flakey and simply not respond for a while even with good signal (at least in my experience with my own phone...) I think you just might need to be patient!

  • AJAX should work fine over cell data connections. There is absolutely nothing different you need to do as a developer, everything is handled by the OS. However cell data connections can be really flakey and simply not respond for a while even with good signal (at least in my experience with my own phone...) I think you just might need to be patient!

    Ashley so do you mean that the cell data connection cannot connect to my website, at least yet? How long would I need to wait. It's been at least a month.

  • try making all the ajax calls in lowercase.. Uppercase dosnt work!

  • Could it be that I'm using a free webhost?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)