Question

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);
Was it helpful?

Solution

I am looking for a way to enable/disable the "auto-sync" checkbox in the "general sync settings".

UPDATE

Try setMasterSyncAutomatically() on ContentResolver.

OTHER TIPS

ContentResolver.setMasterSyncAutomatically(true); // enables AutoSync

You should also add this

<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />

to your AndroidManifest.xml file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top