Query Installed Regions

This guide describes how to read installed offline regions from the SDK, inspect local metadata, and use worker-thread reads when the app needs a complete on-disk snapshot after launch.

When a cold start requires a reliable read of the on-disk manifest, call the following on an IO thread:

1
lifecycleScope.launch {
2
val installed = withContext(Dispatchers.IO) {
3
RegionalOffline.listInstalledRegions()
4
}
5
renderInstalled(installed)
6
}

OfflineInstalledRegion's commonly used fields:

FieldPurpose
regionId, displayNameLocal list and subsequent control
packageCountNumber of installed packages
totalBytesBytes of installed databases recorded in the manifest
regionVersionCompare with the online catalog to detect updates
allTarsOkWhether all region packages were installed successfully
dataSourceTile server that owns the installed data

Other local APIs:

1
val hasAnyRegion = withContext(Dispatchers.IO) {
2
RegionalOffline.hasInstalledOfflineRegions()
3
}
4
5
val localDetail = withContext(Dispatchers.IO) {
6
RegionalOffline.loadOfflineDetail(regionId)
7
}
8
9
val queuedTask = RegionalOffline.queueRecordFor(regionId)

When hasInstalledOfflineRegions() or listInstalledRegions() is called on the main thread, the SDK returns only the already loaded, non-blocking snapshot. Switch to a worker thread when a cold start requires the complete on-disk result.