-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix offline map download resumption #273
Conversation
BLOCKED waiting for the other PRs to be merged |
Pull Request Test Coverage Report for Build 1257
💛 - Coveralls |
The Android MapboxSDK OfflineManager does not directly enable the com.mapbox.mapboxsdk.net.ConnectivityReceiver when offline region download resumes. It is only enabled when an offline region is being created and deactivated immediately after. However, the OfflineManager and it's components do use the com.mapbox.mapboxsdk.net.ConnectivityReceiver(which is a singleton) if it is activated. This fix activates the com.mapbox.mapboxsdk.net.ConnectivityReceiver before an OfflineRegion status is activated and deactivates after the OfflineRegion is done downloading, encounters a tile count limit exception or the Service is shutdown
8034f30
to
dbfe605
Compare
- Replace offline download error notifications - Show inconsistent download size - Fix duplicated offline map download status information
For some reason, I can still download maps even when wifi is off, after downloading a previous map with wifi available. |
When you then turn on the wifi and turn it off, it shows the error notification. However, on wifi resumption, it takes a while for the app to resume downloading. |
Mapbox shares resources if the two or more maps use the same resources. If you download two areas in the same area, or covering some shared area, Mapbox does not redownload such tiles, fonts or other kind of resources |
If it takes less than a minute or around there off, then it is OK. The download progress should be picked up as soon as the device itself establishes that it has a connection/internet connection(If I am not wrong). Longer than that would be an issue Is it clear after how long the download resumes and does the device connect immediately and internet connectivity resume immediately |
Took about 4 min in this scenario. Internet resumes immediately. |
Would it be possible to provide the specific time after which you resumed internet(So that I can test using the same time on my side)? And probably the logs if possible |
Try 5 min. |
Are there any special permissions that are not provided on your phone? This was my result after turning off the WIFI at 7:22/23 pm and resuming at 7:28. It started almost immediately. Took around 10 seconds which is justifiable You can see that the error notification showed up at 7:22 pm and in the second screenshot, my WIFI is on and the download progress had changed |
The test flow I mentioned happened after this #273 (comment). Is that what you followed? If it's still unclear, let's take do this in-person to save on time. |
Cool |
Keep track of ConnectivityReceiver activation and only deactivate the ConnectivityReceiver onDestroy if the counter is greater than 0
Fixed the issue, the ConnectivityReceiver count was going -1 so on reactivating it would be 0 and not 1 which is the point at which the broadcast receiver is enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix failing tests.
Fixes #194
To test, my guess is turning off the internet(Wifi in case it's the source) and turning it back on after 5 mins and 11-13 mins to see if the download continues. It should resume within a few seconds of connecting back.
You should also monitor the log for error-tag logs from Mapbox. The only error-tag logs from Mapbox should be after disconnecting the internet. Error-tag logs while the internet is off indicates that Mapbox is still retrying the connection
More notes are on the issue