mapbox / mapbox/mapbox-navigation-android

Mapbox offline tile cache stored under "data" and not as "cache"

Open
#3,596 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
651
Forks
321
PR merge metrics
No merged PRs in 30d

Description

**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

1. Embed Mapbox Core and UI SDK into app
2. Use it, launch some navigation stuff, drag the map around, not really sure about the specifics.
3. Open app storage settings (see screenshot)

Bildschirmfoto 2020-09-26 um 22 33 57

### 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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Android 10 storage layout with the listed Mapbox Navigation SDK versions, focusing on the Offline tile files and mbgl-offline.db. Trace where those files are initialized and verify that clearing the app cache removes them without removing access tokens or shared preferences; add or update coverage for that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.