Manually set the GPS longitude and latitude on the andorid Simulator

Source: Internet
Author: User

When I use Baidu map to display my bus routes, I need to use GPS longitude and latitude. However, we all know that when obtaining GPS information on the simulator, I use location loc = locationmanager. getlastknownlocation ("GPS"); To obtain location information, but LOC is usually null during debugging. The reason is that the simulator cannot directly obtain the longitude and latitude. We can manually set it on the simulator, provided that your simulator must be in the starting status.

 
You can manually add GPS information to the simulator in either of the following ways:

1. In eclipse, manually set the longitude and latitude under windows --> open perspective --> ddms --> emulator control --> manual, and press the send button.
2. manually add information under cmd.
(1) first open the simulator, run cmd, and enter Telnet localhost 5554 (Note: 5554 is the port of the simulator on the local machine. It may be different. The specific port number, in the upper-left corner of the simulator), the android Console: Type 'help' for a list of commandsok is displayed.If you are a friend of win7, the console may prompt that telnet is invalid or something, because telnet is not displayed by default in win7 and needs to be opened manually. Specifically: [1] control panel --> program --> enable or disable the WINDOWS function, and then select the telnet server and Telnet client. [2] Then manually start Telnet in management tools> services
(2) Use the GEO command to simulate GPS signal sending:
GEO fix Longitude Latitude
(3) a gps icon is added to the status bar of the simulator, and the icon of a small radar appears. Then, use location loc = locationmanager. getlastknownlocation ("GPS"); then you can get the coordinates.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.