I have ready web application and i've made an android app ,using Cordova, from it, it works good, but when i do this:
if (!(<any>window).cordova) {
return this.afAuth.signInWithPopup(provider)
.then(res => {
this.ngZone.run(() => {
this.router.navigate(['main-layout']);
});
}).catch(error => {
window.alert(error);
});
} else {
return this.afAuth.signInWithRedirect(provider);
}
I expect that on android app else
will be reached, but it did not.
So, how can i check whether app is running on android (cordova) or on desktop in Angular?
I've tried this How to detect if I am in browser (local development) in Ionic 2, but it did not help me.
I'm using cordova 9, angular 10.
Thanks.
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-device/index.html
This is a reference for getting device platform for cordova, it could be adding using cmd:
cordova plugin add cordova-plugin-device
Properties:
device.cordova
device.model
device.platform
device.uuid
device.version
device.manufacturer
device.isVirtual
device.serial
You could use device.platform to achieve what you need for example:
if (device.platform === 'iOS') {}
if (device.platform === 'browser') {}
if (device.platform === 'Android') {}
And tou could see full documentation in link above to see more things or other supported platforms