0
I’m creating an app that uses Firebase, and which in turn uses the Google Play Services.
In my tests, when the Google Play Services is outdated, it crashes the application and gives an error saying the application has stopped.
Then appears a notification saying: Update Google Play Services - App only works with an updated version of Google Play Services.
It is possible to make an error treatment to warn the user that Google Play Services update is required without crashing the application and closing it?
He gives me the slip when I run this line:
Button loginbtn = (Button) findViewById(R.id.loginbtn);
loginbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
LoginProcess("[email protected] ", "senha123456");
}
});
...
public void LoginProcess(String email, String password){
mAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
FirebaseUser user = mAuth.getCurrentUser();
Toast.makeText(getParent(), "Logado com sucesso.", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getParent(), "Falha de Login.", Toast.LENGTH_SHORT).show();
}
}
});
}
Ask the question the code you use to "get" Google Play Services.
– ramaral
Thanks for answering @ramaral, I was able to solve it. The code that used google play services was already in question, which is the Firebaseuser firebase that in turn needs Google Play Services to work. I’ve added the answer with my solution.
– Fernando VR