Created
October 29, 2018 19:05
-
-
Save sebastianknopf/b9061c65f376d53da586bd126122699c to your computer and use it in GitHub Desktop.
using osmdroid without external storage permission
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// activity code goes here | |
// ... | |
/* | |
* To avoid the normally required permission ACCESS_EXTERNAL_STORAGE the osmdroid library | |
* offers a way to change the base path and the caching path to any other directory. | |
* We change these directories before initializing our MapView object, so osmdroid | |
* will NOT need the permission called above. | |
* | |
* Note that directories are also objects of type File in Java! | |
*/ | |
Configuration.getInstance().setOsmdroidBasePath(new File(this.getFilesDir() + "/osmdroid/base")); | |
Configuration.getInstance().setOsmdroidTileCache(new File(this.getFilesDir() + "/osmdroid/cache")); | |
this.mapView = this.findViewById(R.id.map_view); | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment