Pages

Thursday 7 March 2013

Android - How to generate Google Map API Key

RUN COMMAND PROMPT AS ADMINISTRATOR.

1.Locate your debug.keystore file
"C:\Users\QTM-19\.android\debug.keystore"

2.Locate keytool.exe in Java\bin folder
"C:\Program Files\Java\jre7\bin"

3.Generate MD5 key using this command in cmd :
C:\Program Files\Java\jre7\bin>keytool -v -list -alias androiddebugkey -keystore C:\Users\QTM-19\.android\debug.keystore -storepass android -keypass android
(remove "-v" if Java version < 7)

Certificate fingerprints:
          MD5:  AB:42:12:2A:80:FF:BE:DD:C3:57:38:80:87:CC:39:B3
          SHA1: 31:4D:1A:58:FF:01:14:79:75:E8:D0:1B:1D:1C:61:CF:7E:71:0D:62
          SHA256: AF:87:67:02:5D:EB:3D:03:80:9C:26:5E:C2:E7:96:67:19:17:66:26:A5:
89:7B:AA:8C:D2:E7:F0:27:42:E0:23
          Signature algorithm name: SHA256withRSA
        Version: 3



4.Get a key for the Google Maps Android API v1:
https://developers.google.com/maps/documentation/android/v1/maps-api-signup

5.To register for a Google Maps Android API v1 Key, follow these steps:
-->If you don't have a Google account, use the link on the page to set one up.
-->Paste the MD5 key
-->Click "Generate API Key"


Generated key:0kVayCORItzMtF85IkONrJY0ECuVYdTcAuUE4HQ


6.Add API KEY to your application's MapView objects:
<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="EXAMPLE_MAPS_API_KEY_STRING" />

 7.Add <uses-library android:name="com.google.android.maps library" :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.package.name">
...
<application android:name="MyApplication" >
<uses-library android:name="com.google.android.maps" />
...
</application>

8.Sign your application with the certificate that corresponds to the Maps API Key referenced in your MapView elements.

==>FOR MORE INFO VISIT:
https://developers.google.com/maps/documentation/android/v1/mapkey

==>How to regenerate debug.keystore? Visit Here :
http://stackoverflow.com/questions/2194808/debug-certificate-expired-error-in-eclipse-android-plugins/2196397#2196397

2 comments :

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hi.At that time working on google map. I want to display map in my activity. I successfully display the map view. But i cant show the map i think i have wrong api key so how can i get api key of google map. I create the keystore and all procedure but i didn't have idea how to get api key from this keystore.
    I also give the all permission in manifest file and also add the google map library than also i cant show the map.in activity also extends mapactivity and also write code fro map in xml.
    In a word,i'm just new to this filed.I am looking for sulution until see your blog,your article is written very well, there is a lot of very useful knowledge to help me solve problems.Thank you.




    Reference: Android Barcode Dll Google Map Generate API KeY

    ReplyDelete