How to set the location manually in Android Studio emulator

Viewed 36260

I have a project in which I need to get the location as India. But in my emulator I am not getting the location.

  • I need to get the location as India
  • when I take the google maps from my emulator, it is showing the current location in middle of the sea.

    API level I am using is 27.
    Emulator I use is Nexus 5x.
    

how to get the current position in this Emulator and also manually.

I tried to edit the location in Emulator and tried to give the latitude and longitude but it is not working.

7 Answers

In 2020 with Android Studio 3.6, the way I had to change the emulator location is slightly different than accepted answer. Here how it is:

First,

click more on emulator

Second, Location is first menu item and it is selected by default. You have to select your location in the map and save that point.

tap on map and set your location point

Third, select the saved point and press on select location button in bottom right corner.

change emulator location

That's it, close that window. You are all done.

Sometimes you may have to close the emulator and open (Not restart).

In my case; until i login my Google account on emulator, location not changed. After login, it's changed. I think it's about Google Services.

In my case, setting the point and restarting the emulator, then signin in to Google account and checking my location in Chrome directly was the solution.

I solved this by wiping the emulator's data and restarting it.

set force Android Location Manager to true. Like this "position = await Geolocator.getCurrentPosition( desiredAccuracy: LocationAccuracy.low, forceAndroidLocationManager: true);" then you will get the location on emulator.

Related