Tuesday, October 15, 2013

How to create basic Android Google maps v2 application and run it on emulator

In this post I'm going to illustrate how we can create a basic Google maps v2 application and how to run it on Android emulator.

Prerequisites for this application
Android sdk with API level 11 or above.

This post consists of three parts.
1. Obtaining a API key for Android.
2. Enabling Google maps v2 in Android emulator.
3. Creating a basic Android application which uses Google maps v2

Lets start with Google maps.
In this first part I'll describe how we can register for the Google maps API for Android
1. Obtaining a API key for Android.
To use Google maps API we need to register for the API and need to get a key for Android. This needs because of the security concerns of Google in order to prevent the abuse usage.
  • Then you will be pointed in to All services page.
  • Scroll down to this page and find Google Maps Android API v2 and click on the activate button.
  • Agree for the Google terms of services and click Accept.
  • Then Google Maps API should be turned on
  • From the left side pane click on API Access.
  • Select Create new Android key.
  • Then we need to find the SHA1 certificate fingerprint.
              - First find where is your debug.keystore file, usually in Windows you can find it in
                C:\Users\YOUR USER NAME\.android
              - Run the following command in Windows command prompt
                keytool -list -v -keystore C:\Users\YOUR USER NAME\.android\debug.keystore    
                -alias  androiddebugkey -storepass android -keypass android
             - The green colored one is the path for your debug.keystore.
             - Then you should be able to find the SHA1 fingerprint, mark it from command prompt,  
                it is something like this
                45:B5:E4:6F:36:AD:0A:98:94:B4:02:66:2B:12:17:F2:56:26:A0:E0
  • Paste SHA1 certificate fingerprint and package  name separated by a semicolon and click Create.
    Note: you have to use the same package name for the project what you have given here
  •  Then the API key will be generated and will be shown as follows.

1 comment:

  1. Wow, marvelous blog format! How long have you been blogging for? you make running a blog glance easy. The total glance of your website is excellent, let alone the content material!
    Create a MySQL database.

    ReplyDelete