I am trying get data from a simple api, it works fine in ionic serve(browser) , But when i build the app http call does not work. my Code is
this.http.get("http://example.com/api/routes").subscribe(response => {
this.routes = response["routes"];
for (let x in this.routes) {
let a = this.routes[x].rou_stops;
let b = a.split(",");
for (let y in b) {
this.newCit.push(b[y]);
}
}
});
please help with this issue.
I think you can use Native HTTP plugin for the device use cases:
usage from the doc:
I am Guessing that your are getting this because of android changes its http architecture.
to make it working on Android go to your project root folder.
yourAppFolder > resources > android > xml > network_security_config.xml Change your network security config to blow code.
This works for me on the Ionic 4 app.