// Encrypted storage (requires Android Keystore) fun putEncrypted(key: String, value: String) { // Encryption logic using MasterKey (AndroidX Security Crypto) } }

// Example for androidutility.v165 object PrefUtils { private var prefs: SharedPreferences? = null

fun putString(key: String, value: String?) { prefs?.edit()?.putString(key, value)?.apply() }

If you tell me more about androidutility.v165 , I can generate a feature that fits perfectly — whether it’s a permission flow helper, a crash-resistant file cache, or a modern WorkManager job scheduler wrapper.

// Safe get with default for missing keys inline fun <reified T> get(key: String, default: T): T { return when (T::class) { String::class -> getString(key, default as String) as T Int::class -> prefs?.getInt(key, default as Int) as T Boolean::class -> prefs?.getBoolean(key, default as Boolean) as T Float::class -> prefs?.getFloat(key, default as Float) as T Long::class -> prefs?.getLong(key, default as Long) as T else -> default } }

fun init(context: Context, name: String = "app_prefs") { prefs = context.getSharedPreferences(name, Context.MODE_PRIVATE) }

fun getString(key: String, defaultValue: String = ""): String { return prefs?.getString(key, defaultValue) ?: defaultValue }