Friday, 25 September 2015

Display Current Location on Map

Hello Guys,

Here I am going to explain about Display Current Location on Map.

NOTE: Please run sample code into your device only.

For that you must have to create a api key with your sha-1 key.

Very first you need to install keytool in your eclipse. For installing keytool follow Step 1.

Step 1: Go to Help --> Install New Software --> Add --> Enter keytool in Name and Enter http://keytool.sourceforge.net/update in Location --> Ok --> Select All --> Next --> Click on Accept radio button --> Finish.

Once Keytool is installed successfully then you will get one alert for restart your eclipse. You must Restart your eclipse.

Create SHA-1 key for your project. Follow Step 2.

Step 2:  C:\Program Files\Java\jdk1.8.0_45\bin>keytool.exe -v -list -alias androiddebugkey -keystore "c:\Users\admin\.android\debug.keystore" -storepass android -keypass android

You have to add your keytool's path instead of "c:\Users\admin\.android\debug.keystore". Rest of the things are same.

Once SHA-1 key is generated copy it from your notpad file for further use.

Now turn for create an api key.

Step 3: Create Google Map API Key using Google Developer Console.

Open following link into your browser.
Link: https://developers.google.com/maps/documentation/android/start

This link is provide whole documentation.

Open https://console.developers.google.com link into your browser and login with your gmail account.

After login with your gmail account you will get below window.




















In same window when you click on Select a project drop down, you will get Create a project option.
Click on Create a project option. You can change your project name.

I give a project name like DisplayCurrentLocation.



















Once your project is created successfully you will get following window.




















From above window you must have to select Google Maps Android API option. Then Click on Enable button. When your api is enabled then you will get following window.




















Then after click on Learn more option in same window and you will get new window.




















Now click on GET A KEY button you will get new window again.


















Click on Continue and you will get a window for create a api key.




















Click on Continue.



























When you click on create you will get your API Key.













This key is used into your app.

Output:


























I am sharing my Sample Code with you.

Download Full Source Code From Here: DisplayCurrentLocation

Happy Coding...!!!






1 comment:

  1. create personal, professional, community maps and share on social network, blogs and sites on community walk

    ReplyDelete