android - Cordova app doesn't get data from webservice on device but works in the emulator -


hello i've built cordova application gets data angular webservice this:

var req = {         method: 'post',         url: 'http://mywebservice.com',         headers: {             'content-type': 'application/json; charset=utf-8'         },         data: { data},         crossdomain: true     };      $http(req).          success(function(data, status, headers, config) {              callback(data);         }).          error(function(data, status, headers, config) {             console.log("error: "+json.stringify(status));     }); 

in ripple emulator or ios emulator works great , data shown. if run app on device no data webservice.

in config.xml have tag:

<access origin="*"/> 

to give access internet. found these permission in androidmanifest.xml:

<uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.access_wifi_state" /> 

so don't understand why i'm getting no data shown if works in emulator.

cordova version 4.3.0.

update: if run app on ios device works. problem appears if run on android device.

where webservice running ? assume running on proper machine.

if yes, explain cors issue on localhost, bypassing fact.

to resolve point, need update webserver enable cors queries.


Comments

Popular posts from this blog

command line - Use qwinsta in PowerShell ISE -

java - Incorrect order of records in M-M relationship in hibernate -

Python website log in: BIG-IP can not find session information in the request -