I am making a dictionary kind of an app which uses
SQLite. I have a single table that keeps the pair of foreign words and their translations. I want to sync this table with a particular spreadsheet in Google Docs.
I ve found this awesome library to retrieve and manipulate
GoogleSpreadsheets, so at least I am covered for that. But I donT feel comfortable about the sync. Now,
- Can I use a
SyncAdapterto do this sync between my
GoogleSpreadsheet? If yes, how would I go about it? Would I retrieve and manipulate the rows of the spreadsheet in the
- What could be the other alternatives for such a scenario? Should I maybe use a normal service to do the check when the user requests it (in the main activity, for example) ?
On the Google I/O vids (particularly on Android REST client apps ) they seem pretty persuasive for using the
SyncAdapter but I am not sure if it could help me without an actual REST service.
Thanks in advance..
One good reason to use the Android
SyncManager is that you will benefit from the Google system knowledge that is useful for preserving battery life and other resources. Some of this content is in the video you link to. For example, exponential back-off logic to prevent wasteful attempts at synchronizing.
There is some good info about battery life preservation by conserving cell radio power in today’s Google I/O 2012 talk “Making Good Apps Great: More Advanced Topics for Expert Android Developers.” While not mentioned explicitly, I think that the
SyncManager is likely to have the battery conserving properties that are mentioned in this video.
Based on my reading (not actually implementing anything) of the APIs and other resources such as the
com.example.android.samplesync package, it seems that the pattern is flexible enough to adapt to your program needs.
The team I’m working with has implemented custom sync for our android app but I can tell you we didn’t consider this option because we were committed to writing as much logic as possible to run with the
WebView. I wouldn’t necessarily recommend that, but that’s beyond the scope here.