This repository was archived by the owner on Nov 20, 2024. It is now read-only.
Bug/#1512 - Storage location on API29 and above#1571
Merged
monsieurtanuki merged 26 commits intoosmdroid:masterfrom Apr 30, 2020
Merged
Bug/#1512 - Storage location on API29 and above#1571monsieurtanuki merged 26 commits intoosmdroid:masterfrom
monsieurtanuki merged 26 commits intoosmdroid:masterfrom
Conversation
no functional changes
no functional changes
no functional changes
Also sanity check if detected path is really available
API should be more consistent in the future. Deprecate old methods.
primarySharedStorage is already included in getStorageList()
…etection API level dependent - for API<19 legacy behaviour is kept - for 19=<API<20 legacy behaviour is kept but additional locations are returned when context is available - for API0>=29 the new method is used. Compatibility for the case where targetAPI<29 is retained. - improved javadoc and method naming
Call getOsmdroidBasePath(Context) on MapView construction to trigger optimal default detection to make sure all following calls without context receive the best or any (on >API29) storage location.
monsieurtanuki
approved these changes
Apr 30, 2020
Collaborator
monsieurtanuki
left a comment
There was a problem hiding this comment.
@cbalster See my comments: if you don't feel like implementing the (small) changes just tell me, I won't fight about it.
...tMapViewer/src/main/java/org/osmdroid/samplefragments/geopackage/GeopackageFeatureTiles.java
Show resolved
Hide resolved
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#1512
Basically a complete overhaul of StorageUtils:
On API29 and above a valid storage location can only be retrieved when a context is available. Therefore a hacky workaround has been implemented in MapView. This should cover most naive usages of the library.
In more advanced cases (e.g. own
MapTileModuleProviderBaseimplementations) this can still lead to problems if the storage detection viagetOsmdroidBasePath(Context)/getOsmdroidTileCache(Context)was not triggered before with a context or a valid directory was set viasetOsmdroidBasePath()/setOsmdroidTileCache().This is not easily fixed due to the Configuration being a static singleton. This should probably be changed in a future release since it also causes lots of other issues (testing, hard to reason about code), but will mean a breaking change.