Domanda

Sto facendo un tipo di dizionario di un'app che utilizza SQLite. Ho un singolo tavolo che mantiene il paio di parole straniere e le loro traduzioni. Voglio Sync questa tabella con un particolare foglio di calcolo in Google Docs .

ho trovato questo BILBRA BRIQUE per recuperare e manipolare GoogleSpreadsheets , quindi almeno io sono coperto per quello. Ma non mi sento a mio agio per la sincronizzazione. Ora,

    .
  1. Posso usare un SyncAdapter per eseguire questa sincronizzazione tra il mio SQLite e un GoogleSpreadsheet? Se sì, come farei? Vorrei recuperare e manipolare le righe del foglio di calcolo nel onPerformSync o Smth?
  2. Cosa potrebbero essere le altre alternative per un tale scenario? Dovrei forse usare un normale servizio per effettuare il controllo quando l'utente lo richiede (nell'attività principale, ad esempio)?

    sui vidi di Google I / O (in particolare su Android Pest Client Apps ) loro Sembra piuttosto persuasivo per l'utilizzo del SyncAdapter ma non sono sicuro che potesse aiutarmi senza un servizio di riposo reale.

    Grazie in anticipo ..

È stato utile?

Soluzione

One good reason to use the Android SyncAdapter, ContentProvider and 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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top