Location Manager In Android Programming

Location Manager in Android Programming

 

This is a sample application which shows the Location by using Google Map. Last blog published in this forum is Use of SQLite.
Underlying Algorithm:
Basic description of algorithm in step by step form:

1.) Create a Project LocManageDemo.
2.) Add the following permissions to your application in AndroidManifest.xml :

 

 

 

3.) Put the following code in res/layout/main.xml :

 

 

 

4.) Replace “Your Maps API Key” with your Google API key.
5.) The next step requires that you have to generate your Google Map key. Steps to generate Google Map Key :
i) Run your cmd prompt.
ii) Reach your folder where you have installed java because you have to use a tool called keytool.exe located here.

 

 

 

iii) Enter the following in cmd prompt.

 

 

 

iv) You will get a MD5 fingerprint something like the text below

 

 

v) Copy the MD5 fingerprint and put it here
http://code.google.com/android/maps-api-signup.html
vi) You will get a Google API key something like this :

 

 

 

6.) Run the application.

Steps to Create:

1.) Open Eclipse. Use the New Project Wizard and select Android Project. Give the respective project name i.e. LocManageDemo. Enter following information:

Project name: LocManageDemo
Build Target: Google APIs
Application name: LocManageDemo
Package name: com.app.LocManageDemo
Create Activity: LocManageDemo

Make sure to select the “Google API” as Target.

On Clicking Finish LocManageDemo code structure is generated with the necessary Android Packages being imported along with LocManageDemo.java. LocManageDemo class will look like following:

 

 

 

Output –The final output:

Comments 6

  1. Hi Sushant,
    Thanks for your post.

    Can I request you to elaborate the below step.
    I am getting keytool error..

    5.iii) Enter the following in cmd prompt.
    keytool.exe -list -alias androiddebugkey -keystore C:myandroid.androiddebug.keystore -storepass android -keypass android
    //the characters marked in red are subject to change according to place where your android file is located

    Regards,
    Prashant

  2. Hi Sushant,
    Thanks for your post.

    Can I request you to elaborate the below step.
    I am getting keytool error..

    5.iii) Enter the following in cmd prompt.
    keytool.exe -list -alias androiddebugkey -keystore C:\myandroid\.android\debug.keystore -storepass android -keypass android
    //the characters marked in red are subject to change according to place where your android file is located

    Regards,
    Prashant

  3. Hello Prashant,

    You need to put correct path of your debug.keystore in place of “C:\myandroid\.android” in given example. You will find it in your “documents and settings”.

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">