Display Offline Maps
This page talks about displaying installed offline map data with the standard MapView, set compatible styles, and use focusPreviewRegion() only as an optional camera helper.
Use the Standard MapView
The map display page does not require a dedicated Offline MapView. The optional focusPreviewRegion() camera helper is invoked through RegionalOffline; tile rendering itself does not depend on download-management initialization:
Complete Activity example:
focusPreviewRegion() is only an optional camera helper. A return value of false means that no indexable bounds are currently available for the region; it does not affect offline tile loading. The application may also save and restore its own camera position.
Map Page Integration Requirements
Handle the map page as follows:
-
Forward the full
MapViewlifecycle: onCreate(), onStart(), onResume(), onPause(), onStop(), onLowMemory(), onSaveInstanceState() and onDestroy(). -
After getMapAsync() returns, set the SDK's predefined
BrightorDarkstyle. -
When navigating from the download page to the map page, pass
regionId. If the camera should move automatically, verify that the region is installed on an IO thread, then call focusPreviewRegion() on the main thread. -
focusPreviewRegion() returns
false: keep the current camera and prompt the user to locate the region manually. Do not treat this result as an indication that the region data is unavailable. -
The map's current tile server must be
NGLTomTom. -
Do not wait for previewBundleReady on the map page, and do not use the download page resource-status API as a
setStyle()condition. -
After returning from the download page, call MapView.onResume() normally. Do not recreate
MapViewor reinitializeRegionalOffline.
When using a custom style, the application must ensure that the style, sprite, glyph, TileJSON, and region-tile URL templates are compatible with the current data source.