Getting Android Google Maps v2 API Key

hellomap2We need to get Google Maps API Key from Google API Console to access the Google Maps server. We need to provide application signing certificate “SHA1 fingerprint” and its package name in order to get the Key. Once we have the key, we will add it to application AbdroidManifest.xml file

( 1 ) Get SHA1 Fingerprint

  • Open Eclipse or ADT
  • Open Window >> Preferences >> Android > Build > SHA1 fingerprint

android-adt-sha12You can also get the SHA1 using command

keytool -list -v -keystore C:\Users\<your user name>\.android\debug.keystore -storepass android -keypass android

( 2 ) Google Cloud Console

  • Go to Google Cloud Console
  • Click On CREATE PROJECT “if you don’t have one or if you want to create a new one”

  • Enter Project Name and Project ID “you may change the default Project ID

  • Click on the new project “android-map”

( 3 ) Switch On Google Maps Android API v2

  • Go to the “created” project console
  • API & auth >> APIs >> Google Maps Android API v2 switch ON

( 4 ) Create New Android Key

  • API & auth >> Credentials
  • Under the Public API access >> Create New Key

  • In the “Create a new key” pop-up window select Android key

  • Enter SHA1;Package name
  • Click Create

( 5 ) View the Key

  • API & auth >> Credentials
  • Under the Public API access
  • Look for Key for Android application

( 6 ) Use the Key

To use the key go to AndroidManifest.xml and add the <meta-data> under <application> as following

<applicatio.......>
        ..............
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyD0bnkRinqfKgRcdHAJTovrm9GtY........... />
    </application>