I've written a sync adapter which I scheduled to run every 6 hours but it 
synchronises every few minutes. 
Below is lines of code which enables sync and adds a periodic sync (period 
is in seconds)

ContentResolver.setIsSyncable(account, Table.AUTHORITY, 1);

ContentResolver.setSyncAutomatically(account, Table.AUTHORITY, true);

ContentResolver.addPeriodicSync(account, Table.AUTHORITY, new Bundle(), 
P.Defaults.DRIVE_SYNC_FREQUENCY);


I tried few things after reading through tutorials and forum:

1. As per the tutorial on Android dev site I disabled sync on network 
trickle and just used addPeriodicSync but then the sync does not run at all

Code:

ContentResolver.setIsSyncable(account, Table.AUTHORITY, 1);

ContentResolver.setSyncAutomatically(account, Table.AUTHORITY, false);

ContentResolver.addPeriodicSync(account, Table.AUTHORITY, new Bundle(), 
P.Defaults.DRIVE_SYNC_FREQUENCY);


2. The period passed to addPeriodicSync was in milliseconds. This didn't 
work either, it still continued to sync very frequently.


3. ContentResolver.notifyChange - I'm passing false for the syncToNetwork 
parameter.


4. I checked the syncstats after the sync and the fields holding error 
count are all zero.


5. Set Syncstat.tooManyRetries = true.


I understand the period between sync cannot be exactly 6 hours anything 
close to that is fine because syncing every few minutes is not acceptable 
for the category of application I'm developing. 

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to