You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
Currently, instances of DefaultFileSource allow revalidation requests regardless of if the host process is running in the background and the map that would benefit from the requests is visible. Mobile applications that are extremely concerned about limiting network requests that is not strictly necessary may see battery performance gains if the revalidation requests were not made in the background.
In general, this behavior probably makes sense as the default on both iOS and Android. In addition, as usage of the SDK grows, the backend will benefit from not having to respond to as many requests as it does today.
We should consider adding and exposing an API to DefaultFileSource (or similar approach) so that each platform can inform it if it makes sense to carryout network requests based on background state (or other factors).
In the iOS SDK, we have a natural mechanism to make use of a request-pausing API, in -[MGLMapView sleepGL:] (which happens when the application recedes to the background or enters background mode) or a similar method that would be added to MGLOfflineStorage.
We could also more aggressively pause at the point where we stop a map view's CADisplayLink (which would also happen when the map view is removed from the view hierarchy or hidden). However, the catch is that the application could have multiple views, so we'd need to refcount somehow to avoid interfering with still-visible views.
Currently, instances of DefaultFileSource allow revalidation requests regardless of if the host process is running in the background and the map that would benefit from the requests is visible. Mobile applications that are extremely concerned about limiting network requests that is not strictly necessary may see battery performance gains if the revalidation requests were not made in the background.
In general, this behavior probably makes sense as the default on both iOS and Android. In addition, as usage of the SDK grows, the backend will benefit from not having to respond to as many requests as it does today.
We should consider adding and exposing an API to DefaultFileSource (or similar approach) so that each platform can inform it if it makes sense to carryout network requests based on background state (or other factors).
cc @jfirebaugh @1ec5 @mick
The text was updated successfully, but these errors were encountered: