Android: How to create a receiver that listen any changes of system settings?

Meroelyth picture Meroelyth · Apr 29, 2012 · Viewed 7.4k times · Source

I'm trying to create a BroadCast receiver that listen any changes of system settings to update a UI.

I wrote a series of action in intent-filter on my android manifest in this way:

<receiver android:name=".Receiver_OnSettingChange">
    <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
            <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
            <action android:name="android.intent.action.AIRPLANE_MODE" />
            <action android:name="android.media.RINGER_MODE_CHANGED" />
            <action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
            <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
            <action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
            <action android:name="android.intent.action.BATTERY_CHANGED" />
            <action android:name="android.net.wifi.WIFI_AP_STATE_CHANGED" />
            <action android:name="android.net.conn.BACKGROUND_DATA_SETTING_CHANGED" />
            <action android:name="com.android.internal.telephony.MOBILE_DATA_CHANGED" />
            <action android:name="com.android.settings.GPS_STATUS_CHANGED" />
            <action android:name="android.nfc.action.ADAPTER_STATE_CHANGE" />
            <action android:name="android.location.PROVIDERS_CHANGED" />
            <action android:name="android.intent.action.USER_PRESENT" />
            <action android:name="com.android.sync.SYNC_CONN_STATUS_CHANGED" />                 
            <action android:name="android.intent.action.MEDIA_SCANNER_FINISHED" />
            <action android:name="android.intent.action.MEDIA_SCANNER_STARTED" />
            <action android:name="android.intent.action.MEDIA_UNMOUNTED" />
            <action android:name="android.intent.action.MEDIA_EJECT" />
            <action android:name="android.intent.action.MEDIA_MOUNTED" />
    </intent-filter>
    </receiver>

but I need to listen every single system settings change (like "auto rotation" from on to off or vice versa, brightness from auto to off or anything else and the others).

If there is an action that I can write in the manifest is better for me.

Many thanks

Answer

CommonsWare picture CommonsWare · Apr 29, 2012

but I need to listen every single system settings change (like "auto rotation" from on to off or vice versa, brightness from auto to off or anything else and the others).

Most do not have broadcast Intents associated with them, sorry.