get google map current location android studio – Here, i have share with you how to get google map current location in android studio using google map API. Now a days there are many apps provide the user current location via google map api. Google map officially provide the API to see the user current location in android app or anything.

This is very simple process make an current location. Okay, lets start our tutorial to get google map current location in android studio.

Get Google Map Current Location Android Studio

1. First, Open Android Studio and create new project. The project name is i have enter GoogleMap, you give any name for the project then click Next.

2. Choose the Google Maps Activity then click Next.

get google map current location android studio

3.Then the Activity Name & Layout Name is default so don’t change it.

google map

4. Then click Finish, now your project is created. After creating project you will see the picture like below

google map

I have select one line in this picture, you have just copy and paste that line in browser, its move on create the Google API and you must login the google account to get the API.

google map

Then click Agree and continue. Hereafter its move on Create API key like this,

google map

Now you have click Create API key. Hereafter the API key is created, like this,

google map

You have click to restrict the key. then the credential tab is opened now you have save click to save.

google map

Now copy your API key and paste from google_maps_api.xml file.

google map

Replace the API key in YOUR_KEY_HERE place. Now run your project the default google map is successfully executed in your emulator like this is my output.

output

Its all default google map, its show the same location in all android devices. Hereafter we have develop the main code to get user current location in google map.

Let’s start, first we have implement the main file of MapsActivity.java. You have add some interface. (like below image)

After add the interface, you have see the red lines in the interface because we not implement any methods so just put your cursor in over the red line and press alt+enter and click on implement methods (like below image).

Note:When you see the red line in your code, in that time put the cursor in red line and click alt+enter then its automatically suggest answer so you have click the labels (like implement methods,import class)

The full code of MapsActivity.java

Here, i have include the full code mapsactivity.java file. so just copy the full code and paste from your mapsactivity.java file.

Now move on the activity_maps.xml and copy the following code.

Download Images

Then finally move on the AndroidManifest.xml and add the following code.

That’s all code. Now run your application. You will get the following output in your application.

Click to download
Click to download