Hi,
I am trying to use Http.post, it works well in serve but does not work on the device (android 4.2.2 and 6.0.1).
Here is my code:
console.log('before');
this.http_m.post(
'http://x.x.x.x/login.php',
JSON.stringify({ user: "xxx", pass: "xxx" }),
{ headers: this.database_m.defaultHeaders }
).subscribe(
data_p => console.log("OK"),
error_p => console.log("error"),
() => console.log("done")
);
console.log('after');
This code is called when I press a button, here is my output for two press on the button:
0 136028 log DEVICE READY FIRED AFTER, 1386, ms
1 188760 log before
2 188778 log after
0 192738 log DEVICE READY FIRED AFTER, 1653, ms
1 194985 log before
2 195007 log after
0 196672 log DEVICE READY FIRED AFTER, 743, ms
I don’t have any errors, the application seems to be restarting.
However it works perfectly in serve.
I checked and I do have the following lines in my 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" />
Also in my config.xml:
<allow-navigation href="http://*/*"/>
<allow-navigation href="https://*/*"/>
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
<access origin="*"/>
What am I missing?
Thanks.