3

First,thank you for your attention to my question

I'm planning to design an Android GPS locating application

here are my difficulties and situations

(1)my computer hardware has been out of date for a long time and running an android emulator for debugging is really time-costing,thus i bought a real device(android cellphone) one week ago,in the aim of replacing emulator during debugging

(2)i know how to send location datas to an emulator via "DDMS/Emulator Control/Location Controls",but it is disabled for a real device

(3)i am programming indoor,thus using physical gps locating function is not acceptable(even if i turn on "a-gps")

(4)i have found another topic here: Android mock location on device? however,i can't open the detail links,like "Andrews link"," http://dehuysser.appspot.com/blog/android-developer-shell-released"

I guess these web sites are forbidden by my country......


Here are my questions:

(A)i have found some codes of making mock loation datas ,but these codes can not activate "onLocationChanged" function

However, i wonder if there is a way to send locating datas from PC to real device via USB port(i'm in USB debugging mode), just like sending locations from DDMS to emulator?

(B)i've got the information that, it is possible to send "geo fix" command to emulator as well as to a real device, by "telnet localhost ", but how to check out the port number occupied by my real device?

i know that 5554 port is used for a emulator,but what about the real device?

i've tried to command "netstat" in terminal, but it's a shame to say that i don't know which port is for my android phone......

(C)If my (A)(B) question is not practical,then what's "settings/applications/development/allow mock location" used for?

Please help me, and thank you for your answer!

4

2 回答 2

2

我已经为此编写了一个应用程序(默认情况下,此功能在手机上不可用)-它是开源的,并提供与模拟器完全相同的界面(telnet 到:5554 并运行“geo fix ...”或“geo nmea” "): 在应用商店MockGeoFix

于 2016-06-20T09:47:14.483 回答
1

使用模拟数据的最简单方法是使用模拟测试位置提供程序 API。它位于文档页面的底部。我已经尝试过了,并且在 onLocationChanged 回调中收到了位置。是一些您可以尝试的代码。

adb 使用的端口通常是 5037。

于 2011-04-19T04:55:31.340 回答