[Android] How to generate Google api key for Android Google maps

This tutorial will show you how to generate google map api key for your android application using google maps.

1. Generate MD5 Certificate fingerprint

First go to the directory C:\Users\<user>\.android and verify whether debug.keystore is present.
Sometimes it happens this key might not present, this might happen if your android setup is new. In that case try to debug one simple application. debug.keystore will appear at path mentioned above.

I am using Windows 7. In case if you are using windows xp, path for the debug.keystore file is C:\Documents and Settings\<user>\.android

Now open the command prompt and go to C:\Program Files\Java\jre6\bin or it might be C:\Program Files\Java\jdk1.6.0\bin.
C:\Program Files\Java\jre6\bin>

Execute following command from above path:

C:\Program Files\Java\jre6\bin>keytool.exe -list -alias androiddebugkey -keystor
e "C:\Users\sameer\.android\debug.keystore" -storepass android -keypass android

It will print the following output:

androiddebugkey, Oct 1, 2011, PrivateKeyEntry,
Certificate fingerprint (MD5): 94:1E:43:49:87:73:BB:E6:A6:88:D7:20:F1:8E:B5:98

copy the MD5 fingerprint shown above: 94:1E:43:49:87:73:BB:E6:A6:88:D7:20:F1:8E:B5:98

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

Once you open above link enter your above MD5 finger print in the shown box and click on Generate api key.

It will show you the following page with your api key. Copy the example xml layout to verify your map is visible.

This api key will not work if you copy your source code from one machine to another machine. The map will be shown as grey tiles. To fix this you have to generate new google map api key with new machine MD5 signature. You have to follow the same steps as mentioned above.

Sameer is a Internet technology Blogger from India. He is currently working in Mobile domain. He love to explore latest technology trends in mobile application development and Internet.

Leave a Reply

© 2014 MobiTechie. All rights reserved. Site Admin · Entries RSS · Comments RSS
Powered by WordPress · Designed by Theme Junkie