general sync settings “auto-sync” checkbox programmatically

前端 未结 2 434
温柔的废话
温柔的废话 2020-12-19 05:56

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

相关标签:
2条回答
  • 2020-12-19 06:23

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

    UPDATE

    Try setMasterSyncAutomatically() on ContentResolver.

    0 讨论(0)
  • 2020-12-19 06:27
    ContentResolver.setMasterSyncAutomatically(true); // enables AutoSync
    

    You should also add this

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

    to your AndroidManifest.xml file.

    0 讨论(0)
提交回复
热议问题