Reputation: 478
I am looking for a way to enable/disable the "auto-sync" checkbox in the "general sync settings".
Afair the stock power control widget has this feature too. If this widget can do, there should be a solution for me too, right? Please guys help me out, I am desperately looking for a solution on the web with no success.
Is it possible that a user interaction is mandatory for this operation? I know I can send an Intent to open the Sync View but this is not my intention!
I am not looking for the sync settings for a specific account as I found in this forum like
ContentResolver.setSyncAutomatically(Account account, String authority, boolean sync);
Upvotes: 7
Views: 3650
Reputation: 37
ContentResolver.setMasterSyncAutomatically(true); // enables AutoSync
You should also add this
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
to your AndroidManifest.xml file.
Upvotes: 0
Reputation: 1006574
I am looking for a way to enable/disable the "auto-sync" checkbox in the "general sync settings".
UPDATE
Try setMasterSyncAutomatically()
on ContentResolver
.
Upvotes: 8