juliano.net
juliano.net

Reputation: 8177

How to use SyncAdapter for an app that doesn't require authentication

I need a way to keep data updated on my app. I read about SyncAdapter and saw that it requires an AbstractAccountAuthenticator, but my app doesn't require the user to fill any user/password information. How can I deal with this?

Upvotes: 0

Views: 1659

Answers (2)

kingston
kingston

Reputation: 11419

If your problem is the sync of the contacts in the native address book and you do not have an authenticator and a user registered with that account-type the contacts that you create will not be shown.

What I did was to create a stub authenticator.

Try this:

example of stub authenticator

Consider that the real problem with SyncAdapter is that it is not active if there is no internet connection. The reason is that the sync adapers are thought to be used to synch your local data with a backend server and so if you do not have internet connection you can't sync and the framework disable the SyncAdapter. What I did was to create my own component for synchronizing the contacts.

Upvotes: 1

Joe Malin
Joe Malin

Reputation: 8641

A sync adapter doesn't require an AbstractAccountAuthenticator. The SampleSyncAdapter uses one, because it uses authentication, but authentication is not necessary. The sample does it because it syncs contacts with the Contacts Provider.

A sync adapter is associated with an account type. You specify this in the XML file for the sync adapter.

Upvotes: 2

Related Questions