简体   繁体   English

Android模拟器-GPS位置

[英]Android Emulator - GPS Location

For a school project we're building an app that uses Google Maps Api. 对于一个学校项目,我们正在构建一个使用Google Maps Api的应用程序。 We're getting this project to run, but the location and the map won't show (see picture). 我们正在运行该项目,但不会显示位置和地图(参见图片)。

The image is uploaded on mediafire, you can see it on with the following link: http://www.mediafire.com/view/?tioqsheq0pqr6jc 该图像已上传到mediafire上,您可以通过以下链接查看该图像: http : //www.mediafire.com/view/?tioqsheq0pqr6jc

(PS: we also tried osmDroid, but the same thing happens.) (PS:我们也尝试了osmDroid,但是发生了同样的事情。)

With iOS programming you can simulate a certain location. 使用iOS编程,您可以模拟某个位置。 How can you do that with Android? 您如何使用Android做到这一点? The only information that I've found is to create a telnet session with the emulator to provide with longitude and lattitude. 我发现的唯一信息是使用模拟器创建telnet会话,以提供经度和纬度。 But that isn't working either. 但这也不起作用。

Thanks in advance. 提前致谢。 Martijn 马丁

EDIT I've already read the post: StackOverflow other link 编辑我已经看过这篇文章: StackOverflow其他链接

But it offers the same solution with telnet, but I'm wondering is there another way 但是它提供了与telnet相同的解决方案,但是我想知道还有另一种方法

To be able to use/view the Maps API, you need to get an API key: https://developers.google.com/android/maps-api-signup 要使用/查看Maps API,您需要获取一个API密钥: https : //developers.google.com/android/maps-api-signup

You also need to add the following in your manifest: 您还需要在清单中添加以下内容:

<uses-library android:name="com.google.android.maps"/>
<uses-permission android:name="android.permission.INTERNET"/>

For the second part of your problem regarding mock locations, you can use DDMS. 对于模拟位置问题的第二部分,可以使用DDMS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM