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_value uses Write.
  • prefs.remove_key uses Critical and requires withAllToolAccess().

Tool Matrix

NameIdPolicyDescription
List Preference Keysprefs.list_keysReadLists keys from a SharedPreferences store.
Get Preference Valueprefs.get_valueReadReads one preference value.
Set Preference Valueprefs.set_valueWriteWrites one preference value.
Remove Preference Keyprefs.remove_keyCriticalDeletes one preference key.

Tool Details

Use read tools for inspection. Enable write and critical tools only when a local debugging workflow needs preference repair.