我已经通过教程完成了所有工作。
使用我的应用程序ID SHA1指纹将android应用程序添加到firebse中。
已安装:
"@ionic-native/google-plus": "^5.0.0-beta.14","cordova-plugin-googleplus": "8.2.0",
在我的AppModule中初始化firebase:
AngularFireModule.initializeApp(firebaseConfig),// <-- firebase here
AngularFireAuthModule,
将GooglePlus添加到我的AppModule提供程序中:
providers: [
GooglePlus
]
登录组件:
import { GooglePlus } from '@ionic-native/google-plus/ngx';
constructor(
private googlePlus: GooglePlus,){}
async nativeGoogleLogin(): Promise<void> {
console.log('trying to log in with google');
try {
await this.googlePlus.login({
'webClientId': '125618127989-slbv15359v8g76elj0664agipfedc5cn.apps.googleusercontent.com','offline': true,'scopes': 'profile email'
}).then(res => console.log(res))
.catch(err => console.log(err))
} catch(err) {
console.log(err)
}
}
googleLogin(){
this.nativeGoogleLogin()
}
Android设备上的错误:
this.googlePlus.login()->对象不是函数(...);
来自ionic info命令的更多信息:
Ionic:
ionic (Ionic CLI) : 4.11.0 (C:\Users\andri\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.3
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : not available
Cordova Plugins : cordova-plugin-ionic 5.4.4,cordova-plugin-ionic-webview 4.1.1,(and 6 other plugins)
尝试修复几天,无法完成。任何人都知道如何解决它,这是什么问题?