可能是这个question被问到关于2-4年ago.Still m不satisfied.My的问题是:“如何以编程方式打开/关闭自动同步”.I不想要任何特定的数据到synchronous.Just想知道,是不是可以通过编程启用或禁用自动同步?如果可能,那么是如何实现的?谁能给我举个例子?
它在Android屏幕上如下所示:

ContentResolver.setSyncAutomatically(account, authority, true);在自动同步中的用途是什么?
提前谢谢。
发布于 2013-07-06 11:55:55
我猜你说的是gmail自动同步电子邮件,对吧?一种方法是setMasterSyncAutomatically() (ContentResolver),适用于所有帐户(和提供商)。如果设置为off/false,则可以禁用所有同步。
这就是我们从android documentation得到的。
public static void setMasterSyncAutomatically (boolean sync)
Added in API level 5
Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored.
This method requires the caller to hold the permission WRITE_SYNC_SETTINGS.
Parameters
sync the master auto-sync setting that applies to all the providers and accountshttps://stackoverflow.com/questions/17489799
复制相似问题