Ionic 2 app can fetch json data in browser but nothing in Device


#1

I have created an app for my WordPress website.
I fetch posts through WordPress API. It’s json data. When i run “ionic serve” command, it runs without any issue.

But when i install the app in my android device, it runs the jsonError() function and wont fetch any data. I have a working connection.
Please tell me what could be the reason and how can i debug my app on mobile?

home.ts

constructor(public navCtrl: NavController, public http: Http, public toastCtrl: ToastController) {
this.http.get(‘http://www.factindianews.com/wp-json/wp/v2/posts’).map(res => res.json()).subscribe(
data => {
this.posts = data;
this.slider = this.posts[0];
console.log(data);
},
err => {
this.jsonError();
}
);
}

jsonError() {
let toast = this.toastCtrl.create({
message: ‘A technical glitch.’,
position: ‘bottom’,
showCloseButton: true,
closeButtonText: ‘OK’,
dismissOnPageChange: true
});
toast.onDidDismiss(() => {
this.navCtrl.pop();
});
toast.present();
}