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
AccountManagerframework of Android. - You will have to compulsorily declare
StubProviderin your app. You may choose not to use it though and use your own database for content storage.
- You will have to define
accountTypeinauthenticator.xml - The same
accountTypewill have to be used when declaringsyncadapter.xml - Same
accountTypewill have to be used when declaringSyncUtils.java - You will have to define
contentAuthorityinsyncadapter.xml - Same will have to be defined in
SyncUtils.java - Same will have to be defined in
AndroidManifest.xml - Change sync time
SYNC_FREQUENCYto your convenience inSyncUtilsclass
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