我的应用使用Firebase身份验证和数据库.每当具有较低Google Play服务版本的手机使用该应用程序时……该功能不起作用,并且它不会告诉用户该版本太低而且应该更新,但它会记录到logcat.所
在主Activity的onCreate()中使用示例:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
GoogleApiAvailability.getInstance().makeGooglePlayServicesAvailable(this)
.addOnCompleteListener(this, new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
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.
}
}
});
...
}
