Skip to content

//sorisdk/com.iplateia.sorisdk/getPreference

getPreference

[androidJvm]
fun getPreference(context: Context, key: String): String?

Retrieve a string preference from shared preferences.

Return

The value of the preference, or null if not found

Parameters

androidJvm

contextThe context from which to access shared preferences
keyThe key for the preference

[androidJvm]
fun getPreference(context: Context, key: String, defaultValue: String): String

Retrieve a string preference from shared preferences with a default value.

Return

The value of the preference, or the default value if not found

Parameters

androidJvm

contextThe context from which to access shared preferences
keyThe key for the preference
defaultValueThe default value to return if the preference is not found