Android Google map 使用
1、使用 Android Google Map Api 之前必须检测系统中是否安装了 Google map 应用,检
测方法如下:
protected boolean checkGoogleMap(){
lean isInstallGMap = false;
List<PackageInfo>
packs = getPackageManager().getInstalledPackages(0);
for (int i = 0; i < packs.size(); i++) {
PackageInfo p = packs.get(i);
if (p.versionName == null) { // system packages
continue;
}
if ("com.google.android.apps.maps".equals(p.packageName)) {
isInstallGMap = true;
break;
}
}
return isInstallGMap;
}
复制代码
2、当检测出系统中没有安装 Google map 应用时,可以转向 Web 版的 Google map 来访
问,如下:
1 Intent it = new Intent(
2 Intent.ACTION_VIEW, Uri.parse(