判断是否安装了Google地图,没有弹出Dialog提示安装:
/**
* For Google Maps Check
*
* @return
*/
private boolean isGoogleMapsInstalled() {
try {
ApplicationInfo info = getPackageManager().getApplicationInfo(
"com.google.android.apps.maps", 0);
return true;
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
private OnClickListener getGoogleMapsListener() {
return new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(
Intent.ACTION_VIEW,
Uri.parse("market://details?id=com.google.android.apps.maps"));
startActivity(intent);
// Finish the activity so they can't circumvent the check
finish();
}
};
}
public void checkGoogleMapInstalled() {
if (!this.isGoogleMapsInstalled()) {
AlertDialog.Builder builder = new AlertDialo