title: Android XMLHttpRequest request fail
body: <p>Im having a problem with a XMLHttpRequest on Android using Eclipse....</p>
  
  <p>If I build and run the app on a connected device, I get no error but when I build the apk and then install on the device I get an error so Im missing a permission or something. Any help appreciated.</p>
  
  <pre><code>      var send = function() {
              a = new XMLHttpRequest();
              a.open((type.toLowerCase()==="post")?"POST":"GET",self._prepareUrl(url),true);//+'&amp;username='+data.userid,true);
              a.onreadystatechange = rsc;
              a.timeout = 50000;
              setTimeout(function () {     /* vs. a.timeout */
                  if (a.readyState &lt; 4) {
                      a.abort();
                  }
              }, 50000);        
  
              a.ontimeout = to;
              a.onerror = err;
              a.onabort = errAbort;
  
              a.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=iso-8859-1");
              a.send(resData);
          };
  </code></pre>
  
  <p>The error function is:</p>
  
  <pre><code>    err = function(){
        alert('send fail: stat: ' +a.status +' state: ' +a.readyState +' rtext: ' +a.responseText);
        },
  </code></pre>
  
  <p>and the message I get is:</p>
  
  <p>status = 0
  state = 4
  no response text</p>
  
  <p>so the request has been aborted but why? I must be missing something in the below files as it does work when I run the app via eclipse which must allow something by default but when the apk is built and installed on the device I get the allow permissions info screen on install which does not appear when running via eclipse.</p>
  
  <p>the manifest is:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;manifest 
  android:versionCode="5" 
  android:versionName="1.3" 
  package="XXXXX" 
  android:windowSoftInputMode="adjustPan"
  xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
  &lt;supports-screens 
      android:anyDensity="true" 
      android:largeScreens="true" 
      android:normalScreens="true" 
      android:resizeable="true" 
      android:smallScreens="true" 
      android:xlargeScreens="true"
  /&gt;
  
  &lt;uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" /&gt;
  
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.CAMERA" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.BROADCAST_STICKY" /&gt;
  &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
  
  &lt;uses-feature android:name="android.hardware.camera.autofocus" android:required="false" /&gt; 
  
  &lt;application android:icon="@drawable/icon" android:label="@string/app_name" 
      android:hardwareAccelerated="true"&gt;
      &lt;activity  android:name="CordovaApp" android:label="@string/app_name"
      android:theme="@android:style/Theme.Black.NoTitleBar"
      android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"&gt;
  
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p>and the cofig.xml is:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;widget id="XXXXXXX" version="0.0.1" xmlns="http://www.w3.org/ns/widgets"     
  xmlns:cdv="http://cordova.apache.org/ns/1.0"&gt;
  
  &lt;access origin="http://127.0.0.1*"/&gt; &lt;!-- allow local pages --&gt;
  &lt;access origin="*" subdomains="true" /&gt;
  
  &lt;log level="DEBUG"/&gt;
  &lt;preference name="useBrowserHistory" value="true" /&gt;
  &lt;preference name="exit-on-suspend" value="true" /&gt;
  &lt;preference name="disallowOverscroll" value="true" /&gt;
  &lt;preference name="loadUrlTimeoutValue" value="60000" /&gt;
  
  &lt;feature name="Camera"&gt;
      &lt;param name="android-package" value="org.apache.cordova.camera.CameraLauncher" /&gt;
  &lt;/feature&gt;
  &lt;feature name="File"&gt;
      &lt;param name="android-package" value="org.apache.cordova.file.FileUtils" /&gt;
  &lt;/feature&gt;
  &lt;feature name="Device"&gt;
      &lt;param name="android-package" value="org.apache.cordova.device" /&gt;
  &lt;/feature&gt;
  &lt;feature name="NetworkStatus"&gt;
      &lt;param name="android-package" value="org.apache.cordova.network-information" /&gt;
  &lt;/feature&gt;
  &lt;feature name="SplashScreen"&gt;
      &lt;param name="android-package" value="org.apache.cordova.splashscreen" /&gt;
  &lt;/feature&gt;
  &lt;feature name="Globalization"&gt;
      &lt;param name="android-package" value="org.apache.cordova.globalization" /&gt;
  &lt;/feature&gt;
  </code></pre>
  
  <p></p>