Guide: Google Maps V2 for Android : Getting the API key
Since I have been working on an Android application that uses Google map
services I have decided to write a couple of posts on this topic.
The application will be posted here as well in the near future.
The first thing you have to know when implementing Google Maps for android is
that you have to produce your own Google Map Android API V2 key.
Now there is a reason that I’m marking this name, take a careful look that you turning on
the right Key in you API Console and that you have chosen the API for Android
and not the Google Maps API V2 or V3 for example.
So how do we get an API key, you ask? Well it’s a few steps task:
1. First of all we need to find our SHA1 key. For debugging
purposes we will use the debug.keystore file to get our SHA1 key. to do that
we will use a tool named ‘Keytool‘ that come with Java installation.
so open you command prompt, head to the following location:
C:\Program Files\Java\<your JDK or JRE instllation>\bin>
and run the next command:
keytool -list -v -keystore C:\Users\<your user name>\.android\debug.keystore -storepass android -keypass android
You will recive the following output:
2. Now that we have the SHA1 key we can head to the Google API’s Console,
sign-in with our Google account and create a new project by clicking the drop box
in the upper-left corner of the screen and choosing the ‘Create…’ option:
Give a name to your project and create it.
3. Once you have done that head to the Services section and turn on the Google Map Android API V2:
4. Now open the API Access section and press the Create new Android key… button.
In the window that opens you will have to enter you SHA1 key you got in the 1. section adding
to it your application package name after a semicolon as in the example:
After pressing the Create button you will recieve you own Google Maps API V2 key for Android.
My next post will explain how to use this key to create a Google map in your application.
FILED UNDER :Guide , Guide - Android Development , Guide - Google Maps for Android