使用osmdroid无需访问外部存储 [英] Using osmdroid without getting access to external storage

查看:92
本文介绍了使用osmdroid无需访问外部存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用中,我使用osmdroid处理地图.地图图块已下载并保存在/storage/osmdroid 中.该应用程序需要权限 WRITE_EXTERNAL_STORAGE READ_EXTERNAL_STORAGE .如果我拒绝访问存储,则不会显示地图.有什么方法可以显示地图而无需访问手机内存?

In my app I am using osmdroid for working with map. Map tiles are downloaded and kept in /storage/osmdroid. The application requires permissions WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE. If I deny access to storage, map is not shown. Is any way to show map without access to phone memory?

推荐答案

https://github. com/osmdroid/osmdroid/wiki/FAQ

重新启动Wiki新闻.是的,您可以将位置更改为应用程序专用存储,在这种情况下,它应该可以正常工作.专家提示:在加载任何地图视图之前进行设置.

Fresh off the wiki press. Yes you can change the location to application private storage, in which case it should work just fine. Pro tip: set these before loading any map views.

OpenStreetMapTileProviderConstants.setCachePath(...) OpenStreetMapTileProviderConstants.setCacheSizes(...) OpenStreetMapTileProviderConstants.setOfflineMapsPath(...) OpenStreetMapTileProviderConstants.setUserAgentValue(...)

OpenStreetMapTileProviderConstants.setCachePath(...) OpenStreetMapTileProviderConstants.setCacheSizes(...) OpenStreetMapTileProviderConstants.setOfflineMapsPath(...) OpenStreetMapTileProviderConstants.setUserAgentValue(...)

更新: 从5.6及更高版本开始的新版osmdroid使用以下内容

Update: Newer versions of osmdroid, starting in 5.6 and up use the following

Configuration.getInstance().setCachePath(...) Configuration.getInstance().setCacheSizes(...) Configuration.getInstance().setOfflineMapsPath(...) Configuration.getInstance().setUserAgentValue(...)

Configuration.getInstance().setCachePath(...) Configuration.getInstance().setCacheSizes(...) Configuration.getInstance().setOfflineMapsPath(...) Configuration.getInstance().setUserAgentValue(...)

这篇关于使用osmdroid无需访问外部存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆