I have angular app while reads webservices from my site, it is working fine on browser, but not on android.
I have build apk through build.phonegap.com/apps
on phone it gives the following error
{"data":"","status":404,"config":
{"method":"GET","transformRequest":[null],
"transformResponse":[null],"async":true,
"url":"http://sub.example.com/api/items/1",
"headers":{"Accept":"application/json, text/plain, */*"}
},
"statusText":"Not Found"}
my http requests code is
$http({
async : true,
url: $scope.server+'/api/items/'+id,
method: "GET",
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).then(function(response) {
$scope.items = response.data;
},function myError(response) {
$scope.error = response;
});
on phone it is request to the right URL, I have copied url from error msg and checked it at chrome on phone, it is opening.
I have also added config.xml to root folder, it changed app title, icon etc but still not working
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.example.sub"
versionCode = "1"
version = "1.0.0" >
<!-- versionCode is Android only -->
<!-- version is in major.minor.patch format -->
<name>my app</name>
<description>
A simple app
</description>
<author href="https://example.com" email="email@gmail.com">
Fakhr-e-Alam
</author>
<access uri="http://*.example.com/" />
<platform name="android">
<icon src="icon.png" density="ldpi" />
</platform>
</widget>