For the complete documentation index, see llms.txt. This page is also available as Markdown.

RemoteConfigVariant

定義

class RemoteConfigVariant {
    val experimentId: String
    val id: String

    fun get(key: String): String?
    fun getAsString(key: String): String?
    fun getAsBoolean(key: String): Boolean?
    fun getAsInt(key: String): Int?
    fun getAsFloat(key: String): Float?
    fun getAsDouble(key: String): Double?

    @Composable
    fun GetAsEmbedding(
        key: String,
        arguments: Any? = null,
        onEvent: ((event: Event) -> Unit)? = null,
        content: (@Composable (state: EmbeddingLoadingState) -> Unit)? = null
    )
}

class RemoteConfig {
    suspend fun fetch(): Result<RemoteConfigVariant>
}

fun interface RemoteConfigListener {
    fun onResult(result: RemoteConfigResult)
}

class RemoteConfigResult {
    val value: RemoteConfigVariant?
    val error: Throwable?
    val isSuccess: Boolean
}

基本取得

Kotlin / Compose

Java

fetchRemoteConfig(...) は Remote Config を非同期で取得し、取得結果をメインスレッド上で RemoteConfigListener に通知します。

取得に成功した場合は isSuccess()true になり、getValue() から RemoteConfigVariant を取得できます。失敗した場合は getError() から原因を取得できます。

Embedding として取得(Compose)

GetAsEmbedding(...) は Jetpack Compose 専用の API です。Java/XML の画面で利用する場合は、アプリモジュールで Kotlin/Jetpack Compose を有効にし、この埋め込み部分だけを Compose で実装して、ComposeView を介して既存の XML レイアウトに組み込んでください。

suspend API で取得(Kotlin)

Last updated