所有谷歌服务,如Firebase,谷歌地图和更多的工作与谷歌播放服务,如果你没有更新他们,任何这些服务将运行在你的设备,你需要更新他们,并确保他们是最新的。
为了避免用户被困在这个窗口,你可以添加一个检查来验证googleplay服务版本是否是最新的,如果不是,你可以重定向你的用户更新它
final String appPackageName = "con.google.android.gms"; // package name of the app
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
if(status == ConnectionResult.SUCCESS) {
//alarm to go and install Google Play Services
}else if(status == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED){
Toast.makeText(context,"please udpate your google play service",Toast.LENGTH_SHORT).show
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}
}
在else语句中,我们将重定向用户以将其安装在此位置
https://play.google.com/store/apps/details?id=com.google.android.gms
要从模拟器更新Google Play服务,请参阅以下答案
updating Google play services in Emulator