Multiple Webviews


#1

I’m running across a strange issue when running my app on an Android device.

When i go to chrome://inspect/#devices at first I run

ionic cordova:run android --device

and most of the times I see only when webview on my device, with the Title:

WebView in com.package.name (58.0.3029.83) (real package name)

After a while (and sometimes at first) I see two webviews, the one above and

WebView in io.ionic.starter /58.0.3029.83)

I if leave the device ou for a bit and I come back to my computer later, I see only the last WebView.

And i think this is messing up my ionic code when authenticating via @ionic-native/facebook and firebase

I have the following code:

facebookSignInUser(): firebase.Promise<any> {
        if (this.platform.is('cordova')) {
            console.log('cordova exists');
            return this.facebook.login(['public_profile', 'email']).then(facebookData => {
                console.log('facebook credentials: OK');
                let provider = firebase.auth.FacebookAuthProvider.credential(facebookData.authResponse.accessToken);
                return firebase.auth().signInWithCredential(provider);
            }).catch(error => {
                console.log('facebook credentials: ERROR');
                return firebase.Promise.reject(error);
            });
        } else {
            console.log('cordova does not exist');
            return this.afAuth.auth.signInWithPopup(new firebase.auth.FacebookAuthProvider);
        }
    }

At first it works just fine, but after I while i get the usual

This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.

I suspect I might be running 2 instances of it for a reason, with different package names.

My system:

Cordova CLI: 6.5.0
Ionic Framework Version: 3.2.1
Ionic CLI Version: 3.0.0-beta.5
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.4
Xcode version: Not installed

Can anyone help?

Thank you.


#2

I would try upgrading CLI to latest stable (3.1.2 as of now).


#3

I cleared the app data and cache on the phone, uninstalled the app manually and ran the ionic cordova run again.

It solved my problem.