I use synchronization adapters in my application to periodically synchronize changes with the server. No matter what value I set in pollFrequency, synchronization is done every 30 seconds.
I checked on the forum and tried the changes suggested in the answers and pass "false" as the syncToNetwork parameter when I raise the notifyChange to ContentResolver.
Continuing the detailed training, I came across this difference.
On the Google developer’s site → training section Training on synchronization adapters
I can see that the addPeriodicSync → pollFrequency parameter is passed in milliseconds
public class MainActivity extends FragmentActivity {
...
public static final String AUTHORITY = "com.example.android.datasync.provider";
public static final String ACCOUNT = "default_account";
public static final long MILLISECONDS_PER_SECOND = 1000L;
public static final long SECONDS_PER_MINUTE = 60L;
public static final long SYNC_INTERVAL_IN_MINUTES = 60L;
public static final long SYNC_INTERVAL = SYNC_INTERVAL_IN_MINUTES *
SECONDS_PER_MINUTE *
MILLISECONDS_PER_SECOND;
ContentResolver mResolver;
...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
mResolver = getContentResolver();
ContentResolver.addPeriodicSync(
ACCOUNT,
AUTHORITY,
null,
SYNC_INTERVAL);
...
}
...
}
API API pollFrequency . ? , ?
.