Check if Google Maps are installed on Android if not, direct user to the Play Store

The Google Maps Android API V2 developers guide is missing an important step. Beyond checking for the availability of Google Play Services on an Android device, you must also make sure the user has the Google Maps app installed. If the user has Google Play Services installed but not Google Maps, your app will load but no map data will download. The map will have zoom buttons and look like a map, but there will never be any content and you’ll notice an error message in LogCat similar to

E/Google Maps Android API(23235): Google Maps application is missing.

Here is example code of how to check if Google Maps are installed and direct the user to the Play Store listing for Google Maps if they are not installed. My setupMapIfNeeded() method is called at the end of onCreate().

private void setUpMapIfNeeded() {
    // Do a null check to confirm that we have not already instantiated the map.
    if (mMap == null) 
        // Try to obtain the map from the SupportMapFragment.
        mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(;

            if (mMap != null) 

                mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(44.9800, -93.2636), 10.0f));
            Builder builder = new AlertDialog.Builder(this);
            builder.setMessage("Please install Google Maps");
            builder.setPositiveButton("Install", getGoogleMapsListener());
            AlertDialog dialog = builder.create();

public boolean isGoogleMapsInstalled()
        ApplicationInfo info = getPackageManager().getApplicationInfo("", 0 );
        return true;
    catch(PackageManager.NameNotFoundException e)
        return false;

public OnClickListener getGoogleMapsListener()
    return new OnClickListener() 
        public void onClick(DialogInterface dialog, int which) 
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?"));

            //Finish the activity so they can't circumvent the check

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s