开发者

How can you find out if sync of an account has turned off?

开发者 https://www.devze.com 2023-03-01 14:47 出处:网络
I have a SyncAdapter that extends AbstractThreadedSyncAdapter. I execute a timer task in onPerformSync met开发者_开发百科hod.

I have a SyncAdapter that extends AbstractThreadedSyncAdapter.

I execute a timer task in onPerformSync met开发者_开发百科hod.

I want to check if the user turned off the Syncing so that I can stop the Timer Task.

I use ContentResolver.isSyncActive() method to check this issue.

the problem is that it always returns false.

so how can I check if Sync is turned on/off ??

Thanks


You want to call ContentResolver.getMasterSyncAutomatically().

That will give you the global setting, whereas getSyncAutomatically just checks whether an individual Account is enabled and isSyncActive simply tells you whether a sync is happening at the moment.


The isSyncActive method just checks if a sync operation is currently running. You want getSyncAutomatically.

0

精彩评论

暂无评论...
验证码 换一张
取 消