Check if user is authenticated for the first time in Firebase Google Authentication in Android

后端 未结 8 1457
一向
一向 2020-11-30 06:16

I am using Firebase Authentication in an Android application, and I am using Google account authentication as an option to sign in to the application.

How can I know

8条回答
  •  天涯浪人
    2020-11-30 07:04

    In Firebase UI, JAVA:

     @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            Intent i;
    
    
            if (requestCode == RC_SIGN_IN) {
                IdpResponse response = IdpResponse.fromResultIntent(data);
    
                if (resultCode == RESULT_OK) {
    
    
                    if(response.isNewUser()){
                    Log.d(TAG, "onActivityResult: isNewUser "+response.isNewUser());
    } else {
    
                    // Successfully signed in
                    }
    
                    // ...
                } else {
    
    
    
    //               handle error
                }
            }
        }
    
    

提交回复
热议问题