Ever wondered how to modify Android Sync settings under Settings -> Accounts -> Account from your app?
- Declare that you app uses android.permission.WRITE_SYNC_SETTINGS permission in Android manifest file.
- Use ContentResolver.setSyncAutomatically() method to check/uncheck the check box on the Account's Sync page.
And if you want to modify master Sync settings under Settings -> Data usage -> Auto-sync data, use ContentResolver.setMasterSyncAutomatically().