In the onCreate of the main activity Example of use in ():
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
GoogleApiAvailability.getInstance().makeGooglePlayServicesAvailable(this)
.addOnCompleteListener(this, new OnCompleteListener() {
@Override
public void onComplete(@NonNull Tasktask) {
if (task.isSuccessful()) {
Log.d(TAG, "onComplete: Play Services OKAY") ;
} else {
// Show the user some UI explaining that the needed version
// of Play Services could not be installed and the app can't run.
}
}
});
...
}
My app uses Firebase authentication Whenever a mobile phone with a lower version of Google Play Services uses the application… the function does not work, and it will not tell the user that the version is too low and should be updated, but it will be logged to logcat. So My question is: do I manually show the warning or can firebase do this for me? What if I have to do it manually?
During application initialization, your code should call GoogleApiAvailability.makeGooglePlayServicesAvailable().
Use example in onCreate() of the main Activity:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);< br />
GoogleApiAvailability.getInstance().makeGooglePlayServicesAvailable(this)
.addOnCompleteListener(this, new OnCompleteListener() {
@Override
public void onComplete(@NonNull Tasktask) {
if (task.isSuccessful()) {
Log.d(TAG, "onComplete: Play Services OKAY");
} else {
// Show the user some UI explaining that the needed version
// of Play Services could not be installed and the app can't run.
}
}
});
...
}