Click here to Skip to main content
13,351,225 members (33,874 online)
Click here to Skip to main content
Add your own
alternative version


23 bookmarked
Posted 3 Jul 2013

Android google map api v2 setup

, 3 Jul 2013
Rate this:
Please Sign up or sign in to vote.
This article shows how to add google maps api v2 to in android projects.


    As you know, after 18th of March 2013, Android Google Api V1 key requests are no more avaible. For those who want to create a map activity, need to get Android Google Api V2 key. So, in this article I will show the steps to get Android Google Api V2 key . 


 For reader, knowing the Eclipse environment , Android sdk and Google Api's will be helpful.  

Using the code   

These are the steps needed to be followed: 

  • Create new android application ( Compile with Google Api  )     
  • Import Google Play Services Lib     
  • Get your SHA1 fingerprint     
  • Get your mapKey by using your SHA1 key     
  • Modify the AndroidManifest.xml  

and thats all, you are ready to go...  

 Create New Android Application  


 Import Google Play Services Lib  

  1. Find your google play services lib  which under the path 
 ....\android-sdk\adt-bundle-windows-x86_64-20130522\adt-bundle-windows-x86_64-20130522\sdk\extras\google and move it to your workspace.   

   2. Import this liblary to your Eclipse 

File\Import\Existing Android Code Into Workspace 


  3. Add google play service lib to your project by right clicking on your project  properties\android and you will see little button on the buttom-right "add". Just add the google play service lib and click ok.


 Get your SHA1 fingerprint  

Go to: 

Window\Preferences   Android\Build      

 find your SHA1 fingerprint and copy that.


Go to Google Apis Console Window.  


  • Create new project. 

  • Activate the option "Google Maps Android API V2" 

  • Click "Create New Android Key" 

  • Enter your SHA1 fingerprint followed by '  ; ' and your application package name.


Modify the AndroidManifest.xml  

 1- Add the following code right before the <application> tag. 



<uses-permission android:name="com.example.osman.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name=""/>
<!-- The following two permissions are not required to use
     Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>



 2- Add this right before the </application> tag 


3-Add this to your main_layout.xml

 <span style="color: black; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; white-space: pre;"> </span><RelativeLayout xmlns:android=""








    tools:context=".MainActivity" >





And your MainActivity will be like this:  

import android.os.Bundle;
import android.view.Menu;
public class MainActivity extends FragmentActivity {
	protected void onCreate(Bundle savedInstanceState) {



  • To use marker on your map, add these codes in to constructor of your MainActivity...,
      GoogleMap googleMap;
        googleMap = ((SupportMapFragment)(getSupportFragmentManager().findFragmentById(;
        LatLng latLng = new LatLng(-33.796923, 150.922433);
        googleMap.addMarker(new MarkerOptions()
                .title("My Spot")
                .snippet("This is my spot!")
        googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 10));  



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Safak Tarazan
Software Developer Information Technologies
Turkey Turkey
With my educational background and personality, I am a multidisciplinary person who has

interest in both computer security and embedded systems.

You may also be interested in...


Comments and Discussions

QuestionGoogle map Pin
Member 1109545122-Apr-15 7:56
memberMember 1109545122-Apr-15 7:56 
GeneralIt Works Fine Pin
8838813225-Mar-15 21:43
professional8838813225-Mar-15 21:43 
QuestionMap shows but not my location Pin
Member 114277287-Feb-15 5:53
memberMember 114277287-Feb-15 5:53 
Questionapp give unfortunately stopeed Pin
Member 824171626-Oct-14 9:42
memberMember 824171626-Oct-14 9:42 
Questiongoogle map Pin
anamicaa15-May-14 1:02
memberanamicaa15-May-14 1:02 
QuestionAdd button Pin
Member 1070470027-Mar-14 14:39
memberMember 1070470027-Mar-14 14:39 
Questiongoogle map v2 Pin
Rye Salvador25-Mar-14 21:27
memberRye Salvador25-Mar-14 21:27 
QuestionThe import cannot be resolved Pin
LakshmiNarayan.G9-Feb-14 21:59
memberLakshmiNarayan.G9-Feb-14 21:59 
AnswerRe: The import cannot be resolved Pin
devBilal20-Mar-14 4:09
memberdevBilal20-Mar-14 4:09 
GeneralRe: The import cannot be resolved Pin
LakshmiNarayan.G24-Mar-14 20:45
memberLakshmiNarayan.G24-Mar-14 20:45 
QuestionI created new project but again this same error occur pls help me sir Pin
Member 102551852-Jan-14 12:45
memberMember 102551852-Jan-14 12:45 
QuestionApplication is force closing... please help me sir Pin
Member 102551852-Jan-14 12:40
memberMember 102551852-Jan-14 12:40 
Questionproblem Pin
Walaa Al-Showa3-Nov-13 13:47
memberWalaa Al-Showa3-Nov-13 13:47 
QuestionIt works fine Pin
Aliking1229-Oct-13 13:15
memberAliking1229-Oct-13 13:15 
Questionafter all the above process, failing with Google Brifge services Pin
Hari Babu Suraneni28-Oct-13 0:14
memberHari Babu Suraneni28-Oct-13 0:14 
AnswerRe: after all the above process, failing with Google Brifge services Pin
Safak Tarazan3-Nov-13 2:27
professionalSafak Tarazan3-Nov-13 2:27 
AnswerRe: after all the above process, failing with Google Brifge services Pin
Truong Nguyen Quang18-Feb-14 0:04
memberTruong Nguyen Quang18-Feb-14 0:04 
Questiongoogle map is not showing Pin
Member 1009381113-Sep-13 1:14
memberMember 1009381113-Sep-13 1:14 
AnswerRe: google map is not showing Pin
Safak Tarazan13-Sep-13 1:17
professionalSafak Tarazan13-Sep-13 1:17 
QuestionNull Pointer Exception Pin
ashish vijay pandey2-Aug-13 3:05
memberashish vijay pandey2-Aug-13 3:05 
AnswerRe: Null Pointer Exception Pin
Safak Tarazan4-Aug-13 0:19
professionalSafak Tarazan4-Aug-13 0:19 
GeneralRe: Null Pointer Exception Pin
ashish vijay pandey5-Aug-13 2:12
memberashish vijay pandey5-Aug-13 2:12 
GeneralRe: Null Pointer Exception Pin
Safak Tarazan6-Aug-13 2:39
professionalSafak Tarazan6-Aug-13 2:39 
GeneralRe: Null Pointer Exception Pin
ashish vijay pandey7-Aug-13 0:04
memberashish vijay pandey7-Aug-13 0:04 
QuestionUnable yo view Map Pin
Member 1009797131-Jul-13 12:52
memberMember 1009797131-Jul-13 12:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180111.1 | Last Updated 4 Jul 2013
Article Copyright 2013 by Safak Tarazan
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid