0% found this document useful (0 votes)
122 views

Getting API Key

The document provides steps to get an API key for Google Maps Android API and integrate it into an Android application. The steps are: 1. Generate the SHA-1 fingerprint from the debug keystore 2. Register the app on the Google API console with the SHA-1 and package name 3. Add the API key to the app manifest 4. Specify required permissions in the manifest 5. Add a MapFragment to the main layout 6. Import Google Play services as a library project

Uploaded by

pacharneajay
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views

Getting API Key

The document provides steps to get an API key for Google Maps Android API and integrate it into an Android application. The steps are: 1. Generate the SHA-1 fingerprint from the debug keystore 2. Register the app on the Google API console with the SHA-1 and package name 3. Add the API key to the app manifest 4. Specify required permissions in the manifest 5. Add a MapFragment to the main layout 6. Import Google Play services as a library project

Uploaded by

pacharneajay
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

GETTING API KEY: D5:E3:B3:61:99:24:86:A8:D1:2A:4F:25:11:FB:AD:A4 98:9E:D3:1C:85:60:85:62:54:6C:FE:80:C3:41:20:5D:10:C0:31:F6 keytool -list -v -alias androiddebugkey -keystore "c:\Users\pop\.android\debug.

keystore" -storepass android -keypass android 98:9E:D3:1C:85:60:85:62:54:6C:FE:80:C3:41:20:5D:10:C0:31:F6 1. Generate sha-1: open cmd prompt. provide the path of keytool.exe(program Files->java-> jdk-> bin). Type the command:

keytool.exe -list -v -alias androiddebugkey -keystore "C:\Users\admin\.android\debug.keystore" -storepass android -keypass android
98:9E:D3:1C:85:60:85:62:54:6C:FE:80:C3:41:20:5D:10:C0:31:F6 2. Register with the Google APIs Console: You have to register in the Google APIs Console that you want to use Google Maps for Android. You can reach this console via the following link: Google APIs Console . go to link ->" https://code.google.com/apis/console". sign in with ur gmail id and password. Select here the Services entry.(towards left side). Activate the Google Maps Android API v2. You need later to register your application via its package in this console together with the SHA-1 fingerprint of your signature key. For this you select the entry and click on the API Access entry. Afterwards click on the Create new Android key... entry. Enter your SHA-1 fingerprint and the package of your application separated by a semicolon.

For ex: F6:B1:14:A6:88:CB:F8:D1:96:CC:F8:1C:A1:92:2A:02:9C:1E:43:B3;com.minds.mapsdemo

SHA-1 certificate fingerprint.

Package name.

3. Adding the api key to your application:


Get your api key and add it in your application manifest file. Using the following tag just b4 </application>

<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value=AIzaSyB9R2HHo9FZqv3sALIVDx4Lxmaf0e29jgw/> </application>

Add the following elements to your manifest. Replace com.example.mapdemo with the package name of your application.

<permission android:name="com.minds.mapsdemo.permission.MAPS_RECEIVE" android:protectionLevel="signature"></permission> <uses-permission android:name="com.minds.mapsdemo.permission.MAPS_RECEIVE"/>

4. Specifying other permissions:


android.permission.INTERNET Used by the API to download map tiles from Google Maps

servers.
com.google.android.providers.gsf.permission.READ_GSERVICES Allows the API

to access Google web-based services.


android.permission.WRITE_EXTERNAL_STORAGE Allows the API to cache map tile data in

the device's external storage area. Add the following tag:

<uses-feature android:glEsVersion="0x00020000" android:required="true" />

5. In main.xml add the following fragment:

<fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.MapFragment"/>

6. Import android code into workspace..(google play services) and use this as ur library project.

You might also like