How to emulate GPS location in the Android Emulator?

前端 未结 30 2337
天命终不由人
天命终不由人 2020-11-21 22:15

I want to get longitude and latitude in Android emulator for testing.

Can any one guide me how to achieve this?

How do I set the location of the emulator to

相关标签:
30条回答
  • 2020-11-21 22:31

    For the new emulator:

    http://developer.android.com/tools/devices/emulator.html#extended

    Basically, click on the three dots button in the emulator controls (to the right of the emulator) and it will open up a menu which will allow you to control the emulator including location

    0 讨论(0)
  • 2020-11-21 22:31

    I was unable to get a GPS fix on the emulator when emulator was running Android image without Google APIs. As soon as I changed the image to contain Google APIs all of the here mentioned ways to get a GPS fix worked.

    Make sure you select an image with Google APIs when creating AVD.

    0 讨论(0)
  • 2020-11-21 22:31

    In eclipse:

    You may have to drag the DDMS window down. 'Location Controls' is located under 'Telephony Actions' and may be hidden by a normally sized console view ( the bar with console, LogCat etc may be covering it!)

    ~

    0 讨论(0)
  • 2020-11-21 22:33

    For a project of my own, I developed an online service which can provide simulated location to the Android emulator.

    It uses geo nmea rather than geo fix which allows it to set speed, course, precise time etc. in addition to just lat/lon.

    The service requires the nc (netcat) command line utility and nothing else.

    http://www.kisstech.ch/nmea/

    0 讨论(0)
  • 2020-11-21 22:34

    Finally with the latest release of Android Studio 4 and his new Emulator update 10/23/2019 it become easier. Start your emulator and go to emulator parameters ... > in "Routes" tab you can choose two points on the map from/to and start a new route with an adjustable playback speed that can go to more than 1000km/h!

    0 讨论(0)
  • 2020-11-21 22:34

    Open Android studio->Tools menu->Android-> Android Device Monitor->Emulator Tab->Location control-> Set your required latitude and longitude and check your project as per your need

    0 讨论(0)
提交回复
热议问题