小编har*_*ers的帖子

ContentResolver.addPeriodicSync间隔向上舍入

我的同步适配器确实工作得非常好,除了在过去的几个小时里有一些小问题让我失意...对于我的应用程序,我希望同步适配器以10秒的间隔运行.

ContentResolver.addPeriodicSync(mAccount, AUTHORITY, Bundle.EMPTY, 5);
Run Code Online (Sandbox Code Playgroud)

会发生什么是同步开始每60秒而不是请求的5秒.当我将其更改interval为70秒时,同步每70秒开始一次.

从日志文件:

W/ContentService? Requested poll frequency of 5 seconds being rounded up to 60 seconds.
Run Code Online (Sandbox Code Playgroud)

或者,为了确保ContentService占用我的间隔,当我将间隔更改为13秒时:

W/ContentService? Requested poll frequency of 13 seconds being rounded up to 60 seconds.
Run Code Online (Sandbox Code Playgroud)

有人知道这次回合的原因吗?

我的摩托罗拉XT搭载Android 5.0.2(Api等级22).

尝试使用模拟器Android 4.0.4(Api等级15),它只在没有日志消息的情况下执行相同的操作,而不是60秒,间隔更改为30秒.所以必须有一些我不知道的限制.

谢谢,如果需要更多信息,请与我们联系.

android intervals android-syncadapter

4
推荐指数
1
解决办法
2046
查看次数

标签 统计

android ×1

android-syncadapter ×1

intervals ×1