Приложение прекрасно работает при запуске через эмулятор или через usb от android studio.но когда я генерирую подписанный APK и запускаю его на физическом устройстве, он не хочет входить в Firebase.
I've made sure i had my Release SHA-1 on firebase, updated my google-services.json.
Я удостоверился, что у меня есть Release SHA-1 на firebase, обновил мой Google-services.json.
void SignInGoogle(){
progressBar.setVisibility(View.VISIBLE);
Intent signIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signIntent,GOOGLE_SIGN);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == GOOGLE_SIGN) {
Task<GoogleSignInAccount> task = GoogleSignIn
.getSignedInAccountFromIntent(data);
try{
GoogleSignInAccount account = task.getResult(ApiException.class);
if(account != null) firebaseAuthWithGoogle(account);
}catch (ApiException e ){
e.printStackTrace();
}
}
}
private void firebaseAuthWithGoogle(GoogleSignInAccount account) {
Log.d("Tag","fierbaseAuthWithGoogle : " + account.getId());
AuthCredential credential = GoogleAuthProvider.getCredential(account.getIdToken(),null);
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this,task -> {
if (task.isSuccessful()){
progressBar.setVisibility(View.INVISIBLE);
Log.d("Tag","Sign in success");
Toast.makeText(MainActivity.this, "Sign in success", Toast.LENGTH_SHORT).show();
FirebaseUser user = mAuth.getCurrentUser();
updateUI(user);
}else{
progressBar.setVisibility(View.INVISIBLE);
Log.d("Tag","Sign in fail");
Toast.makeText(MainActivity.this, "Sign in failed", Toast.LENGTH_SHORT).show();
updateUI(null);
}
});
}