Monday, 28 May 2012

Obtaining Google Maps API Key

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.
During registration, you also need to agree to the Maps API Terms of Service, which describe how your application can use the Maps data.
MapView elements must refer to a Maps API Key, you need to register your certificate and receive a Key before you can make use of MapView elements in your application. To make it easier for you to get started using MapView elements, you are welcome to register the debug certificate generated by the SDK tools and receive a temporary Maps API Key.
To summarize, the important points to understand about MapViews and the Maps API Key are:
  • To display Maps data in a MapView, you need to register for a Maps API Key
  • Each Maps API Key is uniquely associated with a specific certificate, based on an MD5 fingerprint of the certificate
  • Each MapView must reference a Maps API Key, and the Key referenced must be registered to the certificate used to sign the application
  • All MapView elements in an application can reference the same Maps API Key
  • You can register multiple certificates under your developer identity
  • You can get a temporary Maps API Key based on your debug certificate, but before you publish your application, you must register for a new Key based on your release certificate and update references in your MapViews accordingly
Keytool Option                                  Description
-list                        Print an MD5 fingerprint of a certificate.
-keystore <keystore-name>
.keystore                                       The name of the keystore containing the target key.
-storepass <password>          A password for the keystore.
As a security precaution, do not include this option in your command line unless you are working at a secure computer.If
not supplied, Keytool prompts you to enter the password. In this way,your password is not stored in your shell history.

-alias <alias_name>         The alias for the key for which to generate the MD5 certificate fingerprint.
-keypass <password>         The password for the key.As a security precaution, do not include this option in your command line unless you are working at a secure computer.If not supplied, Keytool prompts you to enter the password. In this way, your password is not stored in your shell history.

For this first you choose your directory where your  debug.keystore files resides i.e .android.
 write below commends in command prompt.
and choose your keytool under bin folder of java that resides under
 i.e C:\Users\yourusername\.android>"C:\Program Files\Java\jre\bin\keytool" 
-list -alias androiddebugkey
-keystore debug.keystore -storepass android -keypass android 
 Keytool will prompt you to enter passwords for the keystore and key. As
output of the command, Keytool prints the fingerprint to the shell. For
example:Certificate fingerprint (MD5): 94:1E:43:49:87:73:BB:E6:A6:88:D7:20
 After generating the certificate, paste it in 
Now it generates the Api key.
 Adding the Maps API Key to your application: 
Enable MapView Elements:
 Make sure that you added a <uses-library> element
referencing the external library. The
element must be a child of the <application> element in the
application's manifest. For example:
 <manifest xmlns:android=""
 <application android:name="MyApplication" >
   <uses-library android:name="" />


  1. Thank you so much for this post. It was so informative

  2. Thanks for your good job Lokesh. Really its very helpful for new android developers. continue with it !