我正在使用在Android Studio中创建的模拟器测试地理位置应用程序。我已经通过使用DDMS的经度和纬度,似乎工作。我通过访问Google并检查位置来确认它。位置会根据Lat / Long上的任何更改而变化。 但是,被测试的应用程序没有获取任何位置信息。该应用程序显示位置服务在打开并正常工作时未打开。是否有可以在模拟器上定位应用程序的特定命令?我也尝试了Geo修复命令,但遇到同样的问题。
I am testing a Geo-location App using an Emulator created in Android Studio. I have passed the latitude and longitude using DDMS which seems to work. I confirmed it by going to Google and checking the location. The location changes based on any changes on the Lat/Long. However, the App under test is not getting any location information. The App displays that the location services is not turned on when in fact it is turned on and working fine. Is there a specific command that can target the App on the emulator? I also have tried Geo fix commands but experiencing the same issue.
推荐答案最好的是使用实际的设备,因为不能保证它每次都能正常工作。
this worked for me once. Best is to use actual device as there is no guarantee that it will work everytime.
除非 enableHighAccuracy选项设置为true,否则Android 2.x模拟器不会返回地理定位结果。
The Android 2.x simulators will not return a geolocation result unless the enableHighAccuracy option is set to true.
同样在你的代码中使用它$
Also use this in your code
navigator.geolocation.getCurrentPosition(onSuccess, onError, { maximumAge: 2000, timeout: 10000, enableHighAccuracy: true });并在模拟器中使用telnet输入固定坐标
and use telnet in emulator to enter fixed co-ordinates
samvid@locahost:~$ telnet localhost 5554 Trying 127.0.0.1... Connected to localhost.localdomain. Escape character is '^]'. Android Console: type 'help' for a list of commands OK geo fix 39.09091 27.44011 OK quit Connection closed by foreign host.您可以阅读更多关于它在这里。
更多推荐
GeoLocation App不适用于Android模拟器
发布评论