Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Offline downloads can only happen on main thread #11728

Closed
cammace opened this issue Apr 18, 2018 · 4 comments
Closed

Offline downloads can only happen on main thread #11728

cammace opened this issue Apr 18, 2018 · 4 comments
Labels
Android Mapbox Maps SDK for Android

Comments

@cammace
Copy link
Contributor

cammace commented Apr 18, 2018

Right now, we currently don't allow downloading offline regions on seperate threads, see https://github.com/mapbox/mapbox-gl-native/blob/master/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java#L137 We should allow passing in any threads looper.

cc: @mapbox/maps-android

@jfirebaugh
Copy link
Contributor

The actual network and database operations that are done by GL core do not happen on the main thread though. They are confined to the "DefaultFileSource" thread.

@cammace
Copy link
Contributor Author

cammace commented Apr 18, 2018

I should have been more specific, the status updates are occurring on the main thread. These updates happen rapidly and would be nice to move into a sperate thread were I can then control how often we actually send status updates to the main thread. Say every time x amount of tiles are downloaded, the background thread can notify the main thread rather than the main thread receiving a status update every time a new tile is downloaded.

@ivovandongen
Copy link
Contributor

@cammace In #11284 we take a batched approach in storing tiles to the offline database, the notifications delivered to the main thread would be once per batch (now fixed at 64 tiles). Would this suit your needs?

I think in general, sense of the progress made is important here, but not necessarily at the granularity it has now.

@cammace
Copy link
Contributor Author

cammace commented Apr 23, 2018

This sounds like a good enough compromise to resolving this issue since now the main thread is only being called with an update every batch download.

@cammace cammace closed this as completed Apr 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

3 participants