I have a working prototype of iOS using the iOS caching technique as shown below (Objective-C code):
RMTileCache * tileCache = [[RMTileCache alloc] initWithExpiryPeriod:0];
[tileCache setBackgroundCacheDelegate:self];
RMMapboxSource * tileSource = [[RMMapboxSource alloc] initWithMapID:mapID];
[tileCache beginBackgroundCacheForTileSource:tileSource southWest:southWest northEast:northEasth minZoom:minZoom maxZoom:maxZoom];
Basically this is loading the map, caching tiles forever and the ability to launch the application offline in the future. As we go through the official paid API, this, of course, does not violate any legal restrictions.
Now I would like to achieve the same on Android. I have an SDK running in Android Studio and a working project with a remote card using a card id, basically this (Eclipse format for Android XML):
<com.mapbox.mapboxsdk.views.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
mapid="my_map_id" />
This works fine, but the solution should be completely disabled after caching is complete. My question is: is there a Java equivalent of the iOS source code above in the MapBox SDK? I tried to look in the API, but could not find a reliable link to the plate caching system. And after some painful time, trying to get it to work based on method names and code documentation, I gave up.
I run the latest MapBox distribution from GitHub along with the latest version of Android Studio, everything works fine, but I can not find the code for this. I don't necessarily need an API link, a few lines of code showing how to do it would be enough.
source
share