mapbox-navigation-android
mapbox-navigation-android copied to clipboard
Mapbox offline tile cache stored under "data" and not as "cache"
Android API: Android 10 Mapbox Navigation SDK version:
implementation 'com.mapbox.navigation:ui:1.0.0-rc.7'
implementation 'com.mapbox.navigation:core:1.1.0-alpha.4'
Steps to trigger behavior
- Embed Mapbox Core and UI SDK into app
- Use it, launch some navigation stuff, drag the map around, not really sure about the specifics.
- Open app storage settings (see screenshot)

Expected behavior
An user can clean up app storage by using the "clear cache" feature and mapbox related cache files should get deleted. The mapbox cache files are stored as cache files and not as data.
Actual behavior
Mapbox stores tiles data and its sqlite database in the cache files, as the files are not critical and should be deleted first in my opinion. A user that sees an app using 300 MB of storage, without having manually downloaded a map or any big file, will not really like the big size if storage gets low.
The user will then try to delete the cache, but that may only get 5MB of storage back. The 113 MB of mapbox files pertain to the "data" category and can also be deleted, but if the user does so, access tokens, shared prefs, etc will also be deleted which is not desired.
$ du -h /Users/carstenh/Downloads/extractedAppData/files/
15M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com/2020_02_02-03_00_00/tiles/0/003
15M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com/2020_02_02-03_00_00/tiles/0
8,8M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com/2020_02_02-03_00_00/tiles/1/049
7,5M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com/2020_02_02-03_00_00/tiles/1/050
16M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com/2020_02_02-03_00_00/tiles/1
18M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com/2020_02_02-03_00_00/tiles/2/000/797
7,2M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com/2020_02_02-03_00_00/tiles/2/000/799
8,5M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com/2020_02_02-03_00_00/tiles/2/000/798
5,7M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com/2020_02_02-03_00_00/tiles/2/000/805
8,5M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com/2020_02_02-03_00_00/tiles/2/000/795
4,5M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com/2020_02_02-03_00_00/tiles/2/000/807
5,1M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com/2020_02_02-03_00_00/tiles/2/000/801
57M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com/2020_02_02-03_00_00/tiles/2/000
57M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com/2020_02_02-03_00_00/tiles/2
89M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com/2020_02_02-03_00_00/tiles
89M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com/2020_02_02-03_00_00
89M /Users/carstenh/Downloads/extractedAppData/files//Offline/api.mapbox.com
89M /Users/carstenh/Downloads/extractedAppData/files//Offline
113M /Users/carstenh/Downloads/extractedAppData/files/
(mbgl-offline.db taking 25.7MB is included in there)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Still relevant
cc @mskurydin @etl @kkaefer for visibility
сс @brunoabinader
@mr1sunshine is that something we could add/fix in the SystemInformation API?
@mr1sunshine is that something we could add/fix in the SystemInformation API?
It seems that we can extend our SystemInformation
with an additional path for cache files.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Still relevant
@carstenhag This will be configurable in version 2 of the Nav SDK, which is currently in beta. The storage location can be controlled by constructing a custom TileStore
instance and passing it to the Nav SDK constructor.
However, the default will still be to store tiles as “data” and not ”cache”. The reason for this is that Android (and iOS) reserve the right to delete an app’s cache directory at any time. Users who create offline regions would then be in a situation where they’ve explicitly downloaded an offline region which was deleted automatically by the system, which I’d argue would be the worst case scenario for a navigation app.
Seems like a good solution :).
So I would say if this is documented properly, it could be closed, but I don't know if it is documented. Do you know?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Still relevant I guess. I did not check though. I'm not using mapbox anymore currently.
@kkaefer can you please check?