Issues using ajax on exported apk

1 favourites
  • 3 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hello,

    I've made an api that allows me to get a leaderboard and post highscores into my hosted database. I do requests with the Ajax addon, it works well on the PWA (https://play.ruinfo.ch).

    But it's not working when I export my game to apk. I can still send data using api, but I can't get data from api.. It returns nothing.

    I don't even know how to see what's the error code. What should I do ?

    From PWA :

    From Apk :

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use logcat to get logs from an android app. Add console logging actions to your code, for example:

    Browser Log "AJAX Requesting data"

    Browser Log "AJAX Response: "&sJsonValue

    console.log("aTemp=" + JSON.stringify(aTemp))

    Add "AJAX On Error" event and also put some logging into it.

    Export debug apk, run it, grab logcat log from the phone and search for those console messages. Also check if there are any errors or exceptions in the log which happened at the time of AJAX request.

  • You can use logcat to get logs from an android app. Add console logging actions to your code, for example:

    Browser Log "AJAX Requesting data"

    Browser Log "AJAX Response: "&sJsonValue

    console.log("aTemp=" + JSON.stringify(aTemp))

    Add "AJAX On Error" event and also put some logging into it.

    Export debug apk, run it, grab logcat log from the phone and search for those console messages. Also check if there are any errors or exceptions in the log which happened at the time of AJAX request.

    Thanks, I just figured it out.

    I made my API using PHP, but I just started using php few days ago.

    I had to allow cross-domain on my apiby adding :

    header("access-control-allow-origin: *");

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