Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8968527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:28:01+00:00 2026-06-15T17:28:01+00:00

When using Google Maps Android API V2 I’m following the Google Play Services setup

  • 0

When using Google Maps Android API V2 I’m following the Google Play Services setup documentation to make a check to ensure that Google Play Services are installed, using the following code in my main Activity:

@Override
public void onResume()
{
      checkGooglePlayServicesAvailability();

      super.onResume();
}

public void checkGooglePlayServicesAvailability()
  {
      int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
      if(resultCode != ConnectionResult.SUCCESS)
      {
          Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, this, 69);
          dialog.setCancelable(false);
          dialog.setOnDismissListener(getOnDismissListener());
          dialog.show();
      }

      Log.d("GooglePlayServicesUtil Check", "Result is: " + resultCode);
  }

This works fine. However, I noticed some of the older Android phones I have laying around (mostly running 2.2) were missing both GooglePlayServices as well as the Google Maps app itself.

LogCat will report this error:
Google Maps Android API: Google Maps application is missing.

Question – how can I perform a similar check to the one above for the availability of Google Maps on a device? Secondly, if the user already has Google Maps installed I think the check will need to make sure their installed version is compatible with V2 of the Android Maps API.

Update
Here is my setupMapIfNeeded() method which is called at the end of onCreate(). This is where I think I’d want to determine if Google Maps is installed and alert the user, see the else block:

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(R.id.basicMap)).getMap();

        if (mMap != null) 
        {
            mMap.setLocationSource(this);

            mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(44.9800, -93.2636), 10.0f));
            setUpMap();
        }
        else
        {
            //THIS CODE NEVER EXECUTES - mMap is non-null even when Google Maps are not installed
            MapConstants.showOkDialogWithText(this, R.string.installGoogleMaps);
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:28:01+00:00Added an answer on June 15, 2026 at 5:28 pm

    Alright after more poking and prodding I realized I just need to ask PackageManager if google maps are installed. IMO this should really be included in the Google Maps Android API V2 developers guide…there are going to be lots of devs that miss this case and have frustrated users.

    Here’s how to check if Google Maps are installed and re-direct the user to the Play Store listing for google maps if it’s not installed (see isGoogleMapsInstalled()):

    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(R.id.basicMap)).getMap();
    
            if(isGoogleMapsInstalled())
            {
                if (mMap != null) 
                {
                    setUpMap();
                }
            }
            else
            {
                Builder builder = new AlertDialog.Builder(this);
                builder.setMessage("Install Google Maps");
                builder.setCancelable(false);
                builder.setPositiveButton("Install", getGoogleMapsListener());
                AlertDialog dialog = builder.create();
                dialog.show();
            }
        }
    }
    
    public boolean isGoogleMapsInstalled()
    {
        try
        {
            ApplicationInfo info = getPackageManager().getApplicationInfo("com.google.android.apps.maps", 0 );
            return true;
        } 
        catch(PackageManager.NameNotFoundException e)
        {
            return false;
        }
    }
    
    public 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();
            }
        };
    }
    

    I wrote up a short blog post with these details: How to check if Google Maps are installed and redirect user to the Play Store

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I check the website, I see that web application using Google maps API
I'm using Android and Google Maps at API level 10, and I get latitude
in android application I am using the Google API for maps. I got the
I am writing an android application however I am using the google maps api
I'm writing a phonegap app for iPhone/Android, heavily using the google maps javascript api.
I have some trobule using Google Maps API on Android. In onLocationChanged() I create
Using the com.google.android.maps API, I've got a MapActivity which uses ItemizedOverlay to place several
i am trying to run google map tutorial using following link http://mobiforge.com/developing/story/using-google-maps-android followed all
if we make an application to make route/path using android and google maps, we
I'm developing a map application in Android. I'm using Google maps API to show

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.