How to emulate GPS location in the Android Emulator?

前端 未结 30 2351
天命终不由人
天命终不由人 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:36

    Using the "geo" command in the emulator console

    To send mock location data from the command line:

    1. Launch your application in the Android emulator and open a terminal/console in your SDK's /tools directory.

    2. Connect to the emulator console:

      telnet localhost 5555 (Replace 5555 with whatever port your emulator is running on)

    3. Send the location data: * geo fix to send a fixed geo-location.

      This command accepts a longitude and latitude in decimal degrees, and an optional altitude in meters. For example:

      geo fix -121.45356 46.51119 4392
      

提交回复
热议问题