常规同步设置“自动同步”以编程方式复选框
我正在寻找一种方法来启用/禁用“常规同步设置”中的“自动同步”复选框。
当然,库存电源控制小部件也具有此功能。如果这个小部件能做到的话,我也应该有一个解决方案,对吗?请大家帮帮我,我正在网上拼命寻找解决方案,但没有成功。
此操作是否可能强制要求用户交互?我知道我可以发送一个意图来打开同步视图,但这不是我的意图!
我并不是在寻找特定帐户的同步设置,就像我在这个论坛中找到的那样
ContentResolver.setSyncAutomatically(Account account, String authority, boolean sync);
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);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更新
在
ContentResolver
上尝试setMasterSyncAutomatically()
。UPDATE
Try
setMasterSyncAutomatically()
onContentResolver
.您还应该将其添加
到 AndroidManifest.xml 文件中。
You should also add this
to your AndroidManifest.xml file.