临时缓存地图的一部分(MapView)
我正在开发一个带有 MapView 和 GPS 的应用程序。 我的问题是用户在使用我的应用程序时可能会断开连接,因此他将在完全灰色的地图中行走。我想暂时缓存地图以便稍后查看。 我知道谷歌地图 API 不允许缓存地图,但我想确定是否也禁止临时缓存它(并在应用程序关闭时删除它)。
我听说过 openstreetmaps / osmdroid,但我想确认在删除一半代码之前我必须使用它。
I'm developing an application with the MapView and the GPS.
My problem is that the user might disconnect while using my application, so he'll be walking in a fully grey map. I'd like to cache the map temporarily in order to see it later.
I know that cache the map isn't allowed by the google maps API, but I want to be sure if TEMPORARILY cache it (and delete it when the app is closed) is also forbidden.
I've heard about openstreetmaps / osmdroid, but I'd like to confirm that I HAVE to use it before deleting half of my code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Android 版 Google 地图插件无法实现此目的。
There is no means of accomplishing this with the Google Maps Add-On for Android.
因为我需要satelliteView,所以我最终使用了一个可以改进的方法。
我启动一个线程,要求控制器前往用户附近的位置。它已下载,缓存由 MapView 管理:
现在,我只需要找到“wait(5000)”之外的另一种方法即可知道我正在查看的地图部分已下载。如果我找到一条消息,我会修改此消息。
Because I need the satelliteView, I finally used a method that could be improved.
I start a thread that asks the controler to go to a location near the user. It's downloaded and the cache is managed by the MapView:
Now, I just need to find another way than "wait(5000)" to know that the part of the map I'm looking at is downloaded. I'll modify this message if I find one.
你有完整的例子吗?
我设法使用 2 个 MapView Fragments 部分解决了这个问题,其中一个是不可见的。
然后循环移动相机为其他 MapView 创建缓存
Do you have the whole example of this?
I managed to solve this partially using 2 MapView Fragments , one of them invisible.
Then a loop was moving the camera to create cache for the other MapView