0

I am trying to build a periodic sync in my android app to run periodically every 1 hour. I am following an example from android developer website:

ContentResolver.addPeriodicSync(createDummyAccount(this, "account name"),
                MyContentProvider.AUTHORITY,
                Bundle.EMPTY, getResources().getInteger(R.integer.periodic_sync_interval));

The problem is that sync is being triggered every time the activity is being launched even within one minute.

Can you help please?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • It's behaviour can variate between versions of android: https://stackoverflow.com/questions/31945718/contentresolver-addperiodicsync-interval-round-up Also documantation implies that "This means that the actual start time may drift." – Raskilas Mar 19 '19 at 19:30

1 Answers1

0

Please check the interval documentation: https://developer.android.com/reference/android/content/ContentResolver.html#addPeriodicSync(android.accounts.Account,%20java.lang.String,%20android.os.Bundle,%20long)

pollFrequency   long: how frequently the sync should be performed, in seconds. On Android API level 24 and above, a minmam interval of 15 minutes is enforced. On previous versions, the minimum interval is 1 hour.
ashraf
  • 54
  • 1
  • 7