mercredi 29 avril 2015

Android Account Manager and SyncAdapter

I have a to-do list app just like anydo. The app has store the data in local SQLite DB and sync in back to the server pariodically through API I wrote.

The users has 2 options:

  • Login to the app and be able to share lists and backup data
  • Skip login and only use it locally

Note: Only one user can be logged in at a given time.

I checked a few options to sync the data periodically, and SyncAdapter seems like the best way till now.

After a lot of tutorials which I read, I still have a few unresolved questions:

  1. How can I handle the situation that the user decided to skip authentication? Should I create a fake account? Mark the state with SharedPreferences?
  2. How can I detect that the user removed the account, while the app is running?
  3. There is a way to notify the app (in case it's running) that a sync service is running and data were updated?
  4. Can I make sure only one account will be logged in at given time?

Aucun commentaire:

Enregistrer un commentaire