createSetting

abstract suspend fun createSetting(    ownerId: IviServiceId,     key: BooleanSettingKey,     defaultValue: Boolean,     updateStrategy: SettingUpdateStrategy)

Creates a setting with key and defaultValue. The method must be called when this service or a client service becomes available.

Parameters

ownerId

The ID of the service that owns the setting. Only the owning service can create the same setting multiple times, which may happen if the owning service has been restarted.

key

The setting key that must be unique across all setting keys.

defaultValue

The default setting value.

updateStrategy

The update strategy specifies what happens to the existing setting value when the default value has changed.

Throws

when the setting's type does not match the stored setting's type, unless SettingUpdateStrategy.ALWAYS_UPDATE was set for this setting.


abstract suspend fun createSetting(    ownerId: IviServiceId,     key: IntSettingKey,     defaultValue: Int,     updateStrategy: SettingUpdateStrategy)
abstract suspend fun createSetting(    ownerId: IviServiceId,     key: FloatSettingKey,     defaultValue: Float,     updateStrategy: SettingUpdateStrategy)
abstract suspend fun createSetting(    ownerId: IviServiceId,     key: LongSettingKey,     defaultValue: Long,     updateStrategy: SettingUpdateStrategy)
abstract suspend fun createSetting(    ownerId: IviServiceId,     key: DoubleSettingKey,     defaultValue: Double,     updateStrategy: SettingUpdateStrategy)
abstract suspend fun createSetting(    ownerId: IviServiceId,     key: StringSettingKey,     defaultValue: String,     updateStrategy: SettingUpdateStrategy)
abstract suspend fun createSetting(    ownerId: IviServiceId,     key: BooleanListSettingKey,     defaultValue: ParcelableBooleanList,     updateStrategy: SettingUpdateStrategy)
abstract suspend fun createSetting(    ownerId: IviServiceId,     key: IntListSettingKey,     defaultValue: ParcelableIntList,     updateStrategy: SettingUpdateStrategy)
abstract suspend fun createSetting(    ownerId: IviServiceId,     key: FloatListSettingKey,     defaultValue: ParcelableFloatList,     updateStrategy: SettingUpdateStrategy)
abstract suspend fun createSetting(    ownerId: IviServiceId,     key: LongListSettingKey,     defaultValue: ParcelableLongList,     updateStrategy: SettingUpdateStrategy)
abstract suspend fun createSetting(    ownerId: IviServiceId,     key: DoubleListSettingKey,     defaultValue: ParcelableDoubleList,     updateStrategy: SettingUpdateStrategy)
abstract suspend fun createSetting(    ownerId: IviServiceId,     key: StringListSettingKey,     defaultValue: ParcelableStringList,     updateStrategy: SettingUpdateStrategy)
abstract suspend fun createSetting(    ownerId: IviServiceId,     key: EnumSettingKey,     defaultValue: ParcelableEnum,     updateStrategy: SettingUpdateStrategy)

See also