Android - Get Current location of user on emulator

微笑、不失礼 提交于 2019-12-12 05:18:06

问题


Is it possible to show our current posotion on Android emulator? If yes how?

Thank You.


回答1:


You need to set the latitude and longitude in case of emulator because emulator do not have gps detection hardrware to get current location.

telnet localhost 5554
geo fix <longitude value> <latitude value> For ex: geo fix 68.54546 37.5117579



回答2:


You can fake GPS location data on emulator using DDMS which is explained here: http://developer.android.com/tools/debugging/ddms.html#ops-location and here: http://developer.android.com/guide/topics/location/strategies.html#MockData.




回答3:


You can interact with an emulator instance through its shell.

  1. Start emulator.
  2. From terminal run telnet localhost 5554, you are now in emulator shell.
  3. Type help,it will show available commands , like faking a call, sms, battery etc.
  4. To know more about a command type help <command name>.
  5. Type help geo, it will print available location commands.
  6. Try geo fix 1 1 .
  7. Try more with other latitude and longitude values.


来源:https://stackoverflow.com/questions/14675789/android-get-current-location-of-user-on-emulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!