Question

My app allows people to use and manage their data regardless they're logged in. Though, as I uniquely identify each device, I want to sync data from my anonymous users (not logged ones) as well. So, I was wondering if it is a good practice to create an anonymous account in this case, since SyncAdapters only work with accounts.

Should I create an account for my anonymous users or should I sync their data with threads/AsyncTasks/Loaders? In particular, is there any way to make ContentResolver.requestSync() work without the need of an account?

Was it helpful?

Solution

Using the SyncAdapter/AccountManager in Android is frankly more trouble than it's worth. That specific pattern is best used only when you expect a large number of other applications to want to share your account data (e.g. Twitter or Facebook).

I'd suggest you simply write your own background Service implementation to do your syncing. You can use an AlarmManager to notify the service to sync periodically. Otherwise, you can simply sync when the user opens your application using a basic AsyncTask.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top