Http get ionic 2 error


#1

i’m using two way http get data from Api, when “ionic server” on chrome its good, but “ionic run android --device” => error

  1. Http get angular 2:
    import { Http, Response } from ‘@angular/http’;
    => error: Failed to load resource: net::ERR_NAME_NOT_RESOLVED
  2. HTTP native ionic 2:
    import { HTTP } from ‘ionic-native’;
    => error: “The host could not be resolved”

plz help me fix it, thanks


#2

your device has a stable internet connection?

you added and configured the cordova-whitelist-plugin. So your app is allowed to send request to those apis?


#3

I don’t understand , but I’ve updated to version higher android running normally :frowning:


#4

there are security policies on mobile devices. You have to configure what servers/apis your app is allowed to communicate with. And you do it with the cordova-white-plugin.

Google it :wink: