The bare minimum code that one will have to write to build a working sync adapter for an android app.
- You will have to compulsorily use the
AccountManager
framework of Android. - You will have to compulsorily declare
StubProvider
in your app. You may choose not to use it though and use your own database for content storage.
- You will have to define
accountType
inauthenticator.xml
- The same
accountType
will have to be used when declaringsyncadapter.xml
- Same
accountType
will have to be used when declaringSyncUtils.java
- You will have to define
contentAuthority
insyncadapter.xml
- Same will have to be defined in
SyncUtils.java
- Same will have to be defined in
AndroidManifest.xml
- Change sync time
SYNC_FREQUENCY
to your convenience inSyncUtils
class
Note: In my experience, using `strings.xml` or any other way to declare
'authorities' or 'accountType' stops the sync adapter from working.
I know this sounds weird.
If this project has helped you understand issues, be productive by using this library in your app or just being nice to me, you can always donate me
-
Using Bitcoins: at this address
3QJEmgqXsT1CFLtURYWxzmww59DdKYVwNk
-
Using Paypal: Pay Jay
- UDI COHEN's outdated blog post. Yet thankful to it.
- Obsolete sync adapter github projects