How to properly setup the syncAdapter?

Viewed 3636

I'm a newb with the syncAdapter . i've watched the google IO video (lecture presentation here) , and i've read 2 tutorials (here and here) about it .

i've also tried out the code of the tutorials and it's frustrating that i can't figure out how to implement the syncAdapter correctly .

what i believe is that some of the preferences (either in the manifest or on the xml files) are just wrong , but i can't find out why .

i've succeeded to allow adding the syncing account and also show it with its icon .

however , i'm facing some weird problems that i can't figure out why they occur:

  1. allow the account to synchronize . the end user cannot press on the syncing button . it also doesn't seem to auto-sync even though i've tried to add such a thing upon adding the account .

  2. after adding the account , the end user can see a weird description of the account : "res/xml/authenticator.xml" . not sure where its being set.

  3. when clicking the account (after it was added) , i see an empty list (which is proba. how do i add more items there ? in the future , i need to also sync with facebook and gmail , but i can't event succeed with adding my own contentProvider to this list.

i don't need to do real authorization so i just use the next code instead inside the activity that extends from AccountAuthenticatorActivity :

accountManager.addAccountExplicitly(account, PASSWORD, null);
final Intent intent = new Intent();
intent.putExtra(AccountManager.KEY_ACCOUNT_NAME, USERNAME);
intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE, accountType);
setAccountAuthenticatorResult(intent.getExtras());
setResult(RESULT_OK, intent);
finish();

i've also tried to set auto-syncing and enable syncing by using what's described here.

1 Answers
Related