- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have an app that makes Ajax calls from jQuery. It works fine in simulation from XDK. When built using PhoneGap Build, it works fine on an iPhone, and on an Android device using the PhoneGap app, but not on the Android device when loaded from a .apk file - the ajax call just calls the error callback with status 0.
Here is some trivial code just to test this ability:
$.ajax({ dataType:'json', url: 'https://api.github.com/users/mralexgray/repos', type: 'GET', success:function(data){ console.log("Got some json from github"); }, error: function(jqXHR) { console.log("Failed to get github: " +jqXHR.status); } });
I have included the Cordova Whitelist plugin in config.xml. I have tried both leaving access at "*" and explicitly including "https://api.github.com", either in the plugin with an <access> keyword in config.xml, or as a <meta> tag in index.html. Nothing has worked, so far.
I badly need some help here! I'm guessing that this is a browser security issue or a version issue of some sort, but I can't figure it out.
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
David K. wrote:
When built using PhoneGap Build, it works fine [...] on an Android device using the PhoneGap app, but not on the Android device when loaded from a .apk file
I don't understand what you mean by "on an Android device using the PhoneGap app" in your statement above. Can you clarify? It sounds like you are running your app on an Android device under two different conditions. What do you mean by "the PhoneGap app"? It will help to understand what the differences are between your run conditions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the mean time, after many hours of work, I think I've found the problem: Ajax calls started working again when I added a key to my Android build in the PhoneGap Build screen.
See https://phonegap.com/products/#mobile-app-section and https://phonegap.com/products/#desktop-app-section for Adobe's documentation of the app combination that I am calling "the PhoneGap app".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the update, David. Glad you figured out what was not working.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page