A network error (such as timeout, interrupted connection or unreachable host) has occurred

Hello!

I am using Firebase to log in users.
The process works perfectly on browser, but it doesn’t work on device (testing on Android).

In config.xml:

  <access origin="*"/>
  <allow-navigation href="*"/>
  <allow-intent href="*"/>

In 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" />

Cordova Whitelist Plugin is installed.
Crosswalk plugin is also installed so I can run it on my SIII (4.3).

"dependencies": {
    "@angular/common": "2.4.8",
    "@angular/compiler": "2.4.8",
    "@angular/compiler-cli": "2.4.8",
    "@angular/core": "2.4.8",
    "@angular/forms": "2.4.8",
    "@angular/http": "2.4.8",
    "@angular/platform-browser": "2.4.8",
    "@angular/platform-browser-dynamic": "2.4.8",
    "@angular/platform-server": "2.4.8",
    "@ionic-native/camera": "^3.2.3",
    "@ionic-native/core": "^3.2.3",
    "@ionic/app-scripts": "^1.2.2",
    "@ionic/storage": "2.0.0",
    "angularfire2": "^2.0.0-beta.8",
    "firebase": "^3.7.4",
    "ionic-angular": "2.2.0",
    "ionic-native": "^2.8.1",
    "ionicons": "3.0.0",
    "rxjs": "5.0.1",
    "sw-toolbox": "3.4.0",
    "zone.js": "0.7.2"
  }

As I said the login is working in browser.
Whenever I “ionic build android --prod”, then install it in my android 4.3, It works fine until I try to log in.
It throws this error:
"A network error (such as timeout, interrupted connection or unreachable host) has occurred."
Then I click “log in” again and no error appears and I am able to log in… veeeery weird.

Anyone encountering this error?

Thanks

1 Like

@El_Pollito_Pio you solve the problem? i have the same problem.

1 Like

Yep!

It is related to the native keyboard.
Whenever you type the password and tap on login, the login function fires and then the keyboard hide fires interrupting the connection.

I managed to solve it by installing “@ionic-native/keyboard” and in my log in function first thing I do is hide the keyboard:

loginUser(){
            this.keyboard.close();
            this.presentLoadingDefault();
              this.af.auth.login({
              email: this.email,
              password: this.password
              }).then((response) => {
              this.loading.dismiss();
                this.zone.run(() => {
                    this.navCtrl.setRoot(TabsPage);
                });
              }).catch((error) => {
                  this.loading.dismiss();
                  alert(error);
              });
             }
1 Like

Hola!

He intentado hacer lo que comentas pero nada, me sigue sin funcionar… alguna idea? me estoy volviendo loca! Al final lo que dice es que es un error de conexión, no le veo sentido a que sea tema del nativo del teclado.

Gracias!

Hola NurGuz,

I solved the same problem by adding:

thanks @El_Pollito_Pio