gpt4 book ai didi

java - 应用程序在新的谷歌安卓 map 上崩溃

转载 作者:行者123 更新时间:2023-11-30 03:35:00 25 4
gpt4 key购买 nike

我添加了 google maps v2。他们使用 Google play 服务。从评级来看,似乎大多数用户没有更新 Google Play 服务,因此在尝试打开应用程序时会崩溃。

有什么方法可以使部分代码成为 google play 服务的库,这样它们就不会崩溃......

很想找到任何解决方案

最佳答案

如果用户没有 Google play 服务,您可以显示对话框以获取它

// Getting Google Play availability status
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());


//there are other "status" values as well, you can check according to your need

// Showing status
if(status!=ConnectionResult.SUCCESS){ // Google Play Services are not available

int requestCode = 10;
ialog dialog = GooglePlayServicesUtil.getErrorDialog(status, getActivity(), requestCode);
dialog.show();

}else{ // Google Play Services are available

// get map and play with it
}

ConnectionResult 是:

import com.google.android.gms.common.ConnectionResult;

关于java - 应用程序在新的谷歌安卓 map 上崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16746869/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com