首页 > 解决方案 > 使用 Firebase 登录

问题描述

在我的 Android 应用程序中使用 Google Login 和 firebase 我阅读了文档,但函数“firebaseAuthWithGoogle”不存在。

我的项目 Grandle 文件依赖项

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

//Firebase
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-auth:15.1.0'
implementation 'com.firebase:firebase-client-android:2.5.2'
implementation 'com.google.android.gms:play-services-auth:15.0.1'

//Facebook
implementation 'com.facebook.android:facebook-login:4.32.0'

活动结果函数为

protected  void onActivityResult(int requestCode, int resultCode, Intent data){
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == RC_SIGN_IN_GOOGLE) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        if (result.isSuccess()) {
            // Google Sign In was successful, authenticate with Firebase
            GoogleSignInAccount account = result.getSignInAccount();
            firebaseAuthWithGoogle(account);
        } else {
            // Google Sign In failed, update UI appropriately
            // ...
        }
    }
    callbackManager.onActivityResult(requestCode, resultCode, data);
}

我找不到解决方案。怎么了?

标签: javaandroidfirebasefirebase-authenticationgoogle-signin

解决方案


推荐阅读