1

I am trying to do request cross domain using phonegap/cordova v2.4 in Kindle Fire. I am also using jquery/jquery mobile for the test case. I have had no issues in the past with android devices but when I migrated to Kindle, I cant seem to get the requests to work. My very Simple JS

function deviceInfo(){

alert('hi');
$.ajax({
  url: "URL",
  dataType: 'jsonp',
  crossDomain:true,
  success: function(suc){
      alert('suc');
  },
  failure:function(msg){
      alert('msg');
  }
});}
$(function() {
document.addEventListener("deviceready", deviceInfo, true);
});

My config file for phonegap has the following

<access origin="*" />
<access origin=".*"/>
<access origin="http://127.0.0.1*" />
<access origin="http://localhost:65198*" />

I have tried multiple variations to try to get it to allow any url but cross domain still seems to be an issue. I can test it locally in a web browser and it works fine. I have also tried using a local and remote server and neither work in the app but fine in the browser.

Also tried phonegap jQuery .ajax cross domain requests work in browser, fail in Android SDK And I have these permissions

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Community
  • 1
  • 1
Kalel Wade
  • 7,742
  • 3
  • 39
  • 55
  • is this with the original (Gingerbread) Kindle Fire, or the newer ICS based ones? – Offbeatmammal Feb 13 '13 at 21:23
  • this is with Gingerbread – Kalel Wade Feb 13 '13 at 21:24
  • Stupid question on my part: is the Kindle Fire programmable? I'm looking for a tablet (for programming), and a reader (so I can study without lugging a laptop), but I didn't realize that Kindle Fire was "open". Q: How is Phonegap working for you? Q: Is it a fairly standard Gingerbread, or is it a highly customized version of Android? – paulsm4 Feb 13 '13 at 21:28
  • Kindle is an Android Device so you can program apps for it. https://developer.amazon.com/welcome.html. I am not having any luck getting phonegap working yet but otherwise its no different than an android app. (diff in app purchase and push messaging) – Kalel Wade Feb 13 '13 at 21:34

1 Answers1

0

I was able to get this to work. Definitely user error in this case. The wifi connection was trying to use a couple of the business's next door wifi. It first used one that was open and it updated some of the devices apps which gave the impression that it was connected. Then it lost the signal and tried to switch to a wifi that was protected through a url instead of having a wifi password so it ended up saying its connected but unable to actually process any requests. After I switched to using my own wifi, everything ran smoothly.

Kalel Wade
  • 7,742
  • 3
  • 39
  • 55