- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I'm developing a mobile app that need to consume ajax/json web services.
The application works fine when I test in Intel XDK enviroment and in Intel App Preview android app, but when I build the application an install it in the device and error ocurr. I test in Galaxy S2 (Android 4.1.2) and the response status was 0 and S5 (Android 5.0) and the response was 404 (not found).
I don't know if this affects, but recently the IntelXDK enviroment updated to version 1878 (I think but not sure that before the update I can consume cross domain webservices, is it possible?).
I search for the solution several days and test different codes but the error persist. Finally I create a basic application from XDK to try solve the problem but with no result. This is my test code (extract from the Intel XDK article https://software.intel.com/en-us/xdk/docs/how-to-access-JSON-data-in-HTML5-apps):
<!DOCTYPE html> <html> <head> <title>Blank Cordova App Project Template</title> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <script src="intelxdk.js"></script> <script src="xhr.js"></script> <script src="cordova.js" id="xdkJScordova_"></script> <script src="js/app.js"></script> <!-- for your event code, see README and file comments for details --> <script src="js/init-app.js"></script> <!-- for your init code, see README and file comments for details --> <script src="xdk/init-dev.js"></script> <!-- normalizes device and document ready events, see file for details --> <script src="scripts/jquery.min.js"></script> <script> function transferFailed(e) { alert("Error:"+e.target.status); } function callJsonWS(){ $.getJSON("http://time.jsontest.com", function(data){ alert(data); }); } </script> </head> <body onload="callJsonWS()"> <h1 class="align-center">A Blank Project Template</h1> </body> </html>
The result of the code below is no response when I install the app in the Android device.
Sorry for my english and thank you in advance.
Miguel Ángel
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Miguel,
Please send your whole project in a zip file and also .apk separately. You can PM me your app.
Thanks,
Swati
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Swati,
I test my code again and it works on the emulator. I have tested in XDK 1878 and Motorola Droid as emulator. The application only makes a call on body load and show and alert.
The good news are that your sample code works for me in emulator and in the device too :-). Now I'm going to compare the apps to discover why mine doens't work. When I'll do I'll write again in this thread with the conclusion.
Thans a lot,
Miguel Ángel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Miguel,
The issue with starting your project from scratch from the template in XDK 1878 is that Domain List is left blank in the project build settings. Please put * in the domain list and your ajax call will work in your app.
This issue is being fixed and will be available soon.
Swati
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Swati,
The issue you comment was the problem.
I added <access origin="*"/> to my intelxdk.config.android.xml file and all works fine, in my test app and in my original app.
Thank you very much for your help, I was a little desperate.
Best regards,
Miguel Ángel

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page