GeoLocation App不适用于Android模拟器

编程入门 行业动态 更新时间:2024-10-26 14:35:19
本文介绍了GeoLocation App不适用于Android模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用在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模拟器

本文发布于:2023-11-27 05:05:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636716.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模拟器   不适用于   GeoLocation   App   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!