Google Maps Android API v2 – Tutorial

Google Maps Android API v2, you can add google maps to your android application. It handles access to Google Maps servers, data downloading, map display, and response to map gestures. API’s can be used for further customizaton such as add markers, polygons, and overlays to a basic map, and to change the user’s view of a particular map area.


[su_carousel source=”media: 379,380,381,382,383,384,385,386,387" link=”lightbox” width=”900" height=”500" mousewheel=”no”]

[su_bu[su_button url=”http://cs2guru.com/samples/GoogleMapAPIv2.zip” target=”blank” style=”soft” background=”#51d461" color=”#ffffff” size=”6" center=”yes” icon=”icon: arrow-circle-o-down”]ad Complete Source Code[/su_butto[/su_button]. Configure Google Play Services

For maps api support, Google Play Services library is required to add in project. Refer to Google Play Services Setup.

If you are an eclipse user, Go to menu Window -> Android SDK Manager -> Extras. Install Google Play Service library from there. It will be downloaded to sdk\extras\google\google_play_services\libproject\google-play-services_lib. Import this library project to Eclipse and add as library project for your Google Maps Demo Sample Application (Project->Properties->Android->Add Library).

add_google_play_services_lib

Addition of the Google Play services version to your app’s manifest is required. Edit your application’s AndroidManifest.xml file while creating android application later on, and add the following declaration within the <application> element. This embeds the version of Google Play services that the app was compiled with.

You may also like...

3 Responses

  1. NAUSHAD MADAKIYA says:

    HI
    When i make it from google documentation i got error for invalid api & your code also give same error
    can you give some suggestion ?

    • AndroidSRC . says:

      Dear Naushad,

      As per LogCat output, it could be one of the two possibilities.

      1. At Console side, Google Maps Android API v2 is not turned ON. For reflecting changes, make sure you perform a complete uninstall and install of application.

      2. Maps API key is generated from combination of SHA1 and package name. For the same reason, application apk must be signed with same key as what we used for generating SHA-1.

      You must ensure that SHA-1 fingerprint at Eclipse->Windows->Preferences->Android->Build should be same as SHA1 used to generate Maps API Key i.e. apk must be signed with same key. Or else you need to export Android Application signed with same key and install this signed apk.

      For same reason, APK created from our sample code is now signed with debug key of your eclipse. So it gives you authorization failure.

      Hopefully, it should resolve your problem.

      I have uploaded apk signed with key used for registering key of sample application. You can check if it is running without problem.

      http://cs2guru.com/samples/GoogleMapAPIv2_APK.zip

      • NAUSHAD MADAKIYA says:

        I Followed Same Steps But My Problem Was Package Name In Src & In Manifest Was Different And I Was Adding Package Name From Src Instead Of Manifest File

        Thankyou For Response & Clear Solution 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *