fromFile

fun fromFile(context: Context, fileName: String = "configFile.json", isUserVerificationRequired: Boolean = false, remoteLocaleMap: Map<String, String> = emptyMap(), multimediaExtension: MultimediaCoreExtension? = null, clientType: ClientType = ClientType.MIAW_MOBILE_V1, clientName: ClientName = ClientName.MOBILE_IN_APP_SDK, channelAddressIdentifier: String? = null, attachmentConfiguration: AttachmentConfiguration = AttachmentConfiguration()): CoreConfiguration

Loads a CoreConfiguration from a JSON file in the app's assets/ directory.

This is the recommended approach for most apps. Download the config file from your Salesforce org (Setup > Embedded Service Deployments > your deployment > Get Code File) and place it at src/main/assets/configFile.json (or a custom path).

Parameters

context

An Android Context. The application context is used internally.

fileName

The asset file path relative to the assets/ directory. Defaults to "configFile.json".

channelAddressIdentifier

Optional channel address identifier for scoping cached data to a specific messaging channel. See Configuration.channelAddressIdentifier.

isUserVerificationRequired

Set to true if the deployment requires user verification.

remoteLocaleMap

Locale-to-language mapping for custom label resolution. See Configuration.remoteLocaleMap.

multimediaExtension

Optional extension enabling voice and video capabilities.

clientType

The client protocol version. Defaults to ClientType.MIAW_MOBILE_V1.

clientName

The SDK product name. Defaults to ClientName.MOBILE_IN_APP_SDK.

attachmentConfiguration

Controls attachment behavior such as the maximum number of files per message. See Configuration.attachmentConfiguration.

Throws

If the file cannot be found or read from assets.

If the JSON content cannot be deserialized into a valid configuration.

Samples

val configuration = CoreConfiguration.fromFile(
    context,
    remoteLocaleMap = mapOf("en-CA" to "en", "fr-FR" to "fr", "default" to "en")
)