Getting a Maps API Key from Google in Andriod Application

G

The MapView class in the Maps external library is a very useful class that lets you easily integrate Google Maps into your application. It provides built-in map downloading, rendering, and caching of Maps tiles, as well as a variety of display options and controls.

Because MapView gives you access to Google Maps data, you need to register with the Google Maps service and agree to the applicable Terms of Service before your MapView will be able to obtain data from Google Maps. This will apply whether you are developing your application on the emulator or preparing your application for deployment to mobile devices.

Registering for a Maps API Key is simple, free, and has two parts:

  1. Registering the MD5 fingerprint of the certificate that you will use to sign your application. The Maps registration service then provides you a Maps API Key that is associated with your application’s signer certificate.
  2. Adding a reference to the Maps API Key in each MapView, whether declared in XML or instantiated directly from code. You can use the same Maps API Key for any MapView in any Android application, provided that the application is signed with the certificate whose fingerprint you registered with the service.

Getting the MD5 Fingerprint of the SDK Debug Certificate:

1. first get the full path of “debug.keystore” ,

By default, build tools create the debug keystore in the active AVD directory. The location of the AVD directories varies by platform:

  • Windows Vista: C:Users<user>.androiddebug.keystore
  • Windows XP: C:Documents and Settings<user>.androiddebug.keystore
  • OS X and Linux: ~/.android/debug.keystore
  • If you are using Eclipse/ADT and are unsure where the debug keystore is located, you can select Windows > Prefs > Android > Build to check the full path, which you can then paste into a file explorer to locate the directory containing the keystore.

2. then open command prompt, locate the keytool (which is present in C:\jdkbin> folder)

3. then run the following command.

$ keytool -list -alias androiddebugkey 
-keystore <path_to_debug_keystore>.keystore 
-storepass android -keypass android

here <path_to_debug_keystore > is replace by full path in above first step.
now press enter .

it will ask password.
do not write any thing in password just again press enter.

It will give MD5 fingerprint key , note down it.

 

Registering the Certificate Fingerprint with the Google Maps Service

When you are ready to register for a Maps API Key, load this page in a browser:

http://code.google. com/android/maps-api-signup.html

To register for a Maps API Key, follow these steps:

  1. If you don’t have a Google account, use the link on the page to set one up.
  2. Read the Android Maps API Terms of Service carefully. If you agree to the terms, indicate so using the check-box on the screen.
  3. Paste the MD5 certificate fingerprint of the certificate that you are registering into the appropriate form field.
  4. Click “Generate API Key”

use this unique key in your application .

You will get result ,

Thanks

About the author

prasham.tated
By prasham.tated

Category