I have an application with a SyncAdapter
. Additionally to the normal synchronization I trigger a USER_READ
event with which I just pass a Bundle
to the adapter without persisting it:
Bundle settingsBundle = new Bundle();
settingsBundle.putString(SyncAdapter.USER_READ, uid);
ContentResolver.requestSync(account, authority, settingsBundle);
This will correctly call my synchronization routine sometime in the future. Every uid
set in the Bundle
will trigger its own run and everything gets synced as expected.
If now the connection is bad, or the request times out, then I set a soft error:
syncResult.stats.numIoExceptions += 1;
which will cause the request to be repeated later. This also works just fine.
How long do these SyncRequests / Bundles get persisted?
The documentation states, that encountering a soft error will cause an exponentional backoff and that the sync will be run some time later.
- Will it be canceled at some point? After multiple soft errors?
- Will it be enqueued again after a reboot of the device?
Given the connection is bad and the synchronization fails multiple times with soft errors: I would like to know if just enqueuing a sync request is enough, or if I have to provide some sort of persistence myself to ensure requests being sent at some point.