How to emulate GPS location in the Android Emulator?

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

    1. Android Studio users.

    After running the emulator goto Tools->Android->Android device monitor

    Click the Emulator Control Tab change from the location controls group.

    2. Eclipse users.

    First In Eclipse In Menu Select "Window" then Select "Open Perspective" then Select "DDMS". i.e Window->Open Prespective->DDMS.

    You will see on Left Side Devices Panel and on Right Side you will see different tabs. Select "Emulator Control" Tab.

    At bottom you will see Location Controls Panel. Select "Manual" Tab.

    Enter Longitude and Latitude in Textboxs then Click Send Button. It will send the position to you emulator and the application.

    3. Using telnet.

    In the run command type this.

    telnet localhost 5554
    

    If you are not using windows you can use any telnet client.

    After connecting with telnet use the following command to send your position to emulator.

    geo fix long lat    
    geo fix -121.45356 46.51119 4392
    

    4. Use the browser based Google maps tool

    There is a program that uses GWT and the Google Maps API to launch a browser-based map tool to set the GPS location in the emulator:

    android-gps-emulator

提交回复
热议问题