首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在Android中以编程方式打开自动同步

在Android中以编程方式打开自动同步
EN

Stack Overflow用户
提问于 2013-07-05 21:15:00
回答 1查看 1.6K关注 0票数 0

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

它在Android屏幕上如下所示:

ContentResolver.setSyncAutomatically(account, authority, true);在自动同步中的用途是什么?

提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2013-07-06 11:55:55

我猜你说的是gmail自动同步电子邮件,对吧?一种方法是setMasterSyncAutomatically() (ContentResolver),适用于所有帐户(和提供商)。如果设置为off/false,则可以禁用所有同步。

这就是我们从android documentation得到的。

代码语言:javascript
运行
复制
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 accounts
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17489799

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档