我正在使用ContentObserver来检查我的移动设置是否已更改。
public class SettingsContentObserver extends ContentObserver {
Context mContext;
public SettingsContentObserver(Handler handler, Context context) {
super(handler);
this.mContext = context;
}
@Override
public boolean deliverSelfNotifications() {
return super.deliverSelfNotifications();
}
@Override
public void onChange(boolean selfChange) {
super.onChange(selfChange);
// code here
}
}
它工作正常。如何查看哪个设置已更改 - 如亮度或音量或铃声?
这里我注册了这个contentobserver:
SettingsContentObserver mSettingsContentObserver = new SettingsContentObserver( new Handler(),serviceContext );
serviceContext.getContentResolver().registerContentObserver(
android.provider.Settings.System.CONTENT_URI, true,
mSettingsContentObserver);