general sync settings “auto-sync” checkbox programmatically

不问归期 提交于 2019-12-01 04:56:59

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

UPDATE

Try setMasterSyncAutomatically() on ContentResolver.

ContentResolver.setMasterSyncAutomatically(true); // enables AutoSync

You should also add this

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

to your AndroidManifest.xml file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!