Understand the saved settings affecting app behavior
Inspect approved preference values in your Android app and make targeted changes during local debugging.
Preferences tools help explain behavior that depends on saved configuration or user state. Read the allowed stores and keys, then enable writes or removal only when you need to test or repair a specific setting.
Install
Published artifact: ai.ansight:ansight-tools-preferences-android.
dependencies {
debugImplementation("ai.ansight:ansight-tools-preferences-android:latest.release")
}
Register the Suite
import ai.ansight.runtime.AnsightOptions
import ai.ansight.tools.preferences.withPreferencesTools
val options = AnsightOptions.createBuilder()
.withPreferencesTools {
withDefaultStore("${application.packageName}_preferences")
allowKeyPrefix("debug.")
}
.withReadWriteToolAccess()
.build()
Registration API
withPreferencesTools(...): registers the suite.withDefaultStore(...): sets the default SharedPreferences store.allowStore(...): allows a store.allowKey(...)/allowKeyPrefix(...): allow specific keys or prefixes.
Specific Concerns
- Preference values often include configuration or user state.
- Restrict stores, keys, or key prefixes at registration time.
prefs.set_valueusesWrite.prefs.remove_keyusesCriticaland requireswithAllToolAccess().
Tool Matrix
| Name | Id | Policy | Description |
|---|---|---|---|
List Preference Keys | prefs.list_keys | Read | Lists keys from a SharedPreferences store. |
Get Preference Value | prefs.get_value | Read | Reads one preference value. |
Set Preference Value | prefs.set_value | Write | Writes one preference value. |
Remove Preference Key | prefs.remove_key | Critical | Deletes one preference key. |
Tool Details
Use read tools for inspection. Enable write and critical tools only when a local debugging workflow needs preference repair.