I need assistance with my Ionic app. It works on Android device using "@ionic-native/http": "^5.30.0" The problem is very strange..
Let's say we have a simple username/password login form.
- Initially we are using 4G to login and the login is successful (The problem is not only with the login)
- We log out of the app and we see the same screen - the login form..
- On the device itself we turn on the WiFi and connect to any network (with or without internet)
- If we try to login with the connected network (if there's internet, the login will be successful)
- We will not use the WiFi and we want to revert using 4G again as the first time.
- We disconnect manually the WiFi
- On login we will receive error: {"status":-3,"error":"Host could not be resolved: java.net.UnknownHostException: Unable to resolve host
Surely there is network connection, as I can minimize the application and browse the web, also connect to the server and make HTTP call to it.
This used to work before a couple of months when I was playing around with it..
I have the server domain in the NetworkSecurity.config
I have these permissions in my app.component.ts
this.androidPermissions.requestPermissions([
this.androidPermissions.PERMISSION.CAMERA,
this.androidPermissions.PERMISSION.CHANGE_NETWORK_STATE,
this.androidPermissions.PERMISSION.CHANGE_WIFI_STATE,
this.androidPermissions.PERMISSION.DUMP,
this.androidPermissions.PERMISSION.INTERNET,
this.androidPermissions.PERMISSION.MANAGE_EXTERNAL_STORAGE,
this.androidPermissions.PERMISSION.WRITE_EXTERNAL_STORAGE,
this.androidPermissions.PERMISSION.ACCESS_WIFI_STATE,
this.androidPermissions.PERMISSION.ACCESS_NETWORK_STATE,
this.androidPermissions.PERMISSION.ACCESS_BACKGROUND_LOCATION
]);
I have also enabled fast network switch from dev options.
I've read s lot in the web related to this problem but can't find a solution.
I've tried updating all packages, reinitializing the platform and removing the node modules The behavior is consistent and can be reproduced every time.