setMaximumAmbientCacheSize

Sets the maximum size in bytes for the ambient cache.

This call is potentially expensive because it will try to trim the data in case the database is larger than the size defined. The size of offline regions are not affected by this settings, but the ambient cache will always try to not exceed the maximum size defined, taking into account the current size for the offline regions.

Note that if you use the SDK's offline functionality, your ability to set the ambient cache size will be limited. Space that offline regions take up detract from the space available for ambient caching, and the ambient cache size does not block offline downloads. For example: if the maximum cache size is set to 50 MB and 40 MB are already used by offline regions, the ambient cache size will effectively be 10 MB.

Setting the size to 0 will disable the cache if there is no offline region on the database.

This method should always be called at the start of an app, before setting the style and loading a map. Otherwise, the map will instantiate with the default cache size of 50 MB.

Parameters

size

the maximum size of the ambient cache

callback

the callback to be invoked when the the maximum size has been set or when the operation erred.