Valhalla

constructor(context: Context, config: ValhallaConfig, valhallaConfigManager: ValhallaConfigManager = ValhallaConfigManager(context), moshi: Moshi = defaultMoshi())

Writes config to the device, then builds the engine from it.

Parameters

context

The Android context used for file system operations and configuration management.

config

The Valhalla configuration specifying tile locations and routing options.

valhallaConfigManager

Manages the Valhalla configuration file on the device. Defaults to a new instance, which writes to one fixed valhalla.json — give each instance its own com.valhalla.valhalla.files.ValhallaFile when more than one is alive at a time.

moshi

JSON serialization adapter. Defaults to a Moshi instance with Kotlin reflection support.


constructor(configPath: String, moshi: Moshi = defaultMoshi())

Builds the engine from a config file already on disk.

Use this when the app ships or downloads a complete valhalla.json rather than building one from a ValhallaConfig. The tile paths inside it must be absolute and correct for this device; nothing here rewrites them. This is the counterpart of iOS's Valhalla(configPath:).

Parameters

configPath

Absolute path of the valhalla config JSON.

moshi

JSON serialization adapter. Defaults to a Moshi instance with Kotlin reflection support.