AccountAuthenticator and SyncService behaviour

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

AccountAuthenticator and SyncService behaviour

Postby KRC » Wed Feb 17, 2010 11:06 am

Hi,

I am trying to develop AccountAuthenticator and SyncService.
I need help to know more about following points

1. If I add any new account, will it bind this account with SyncService which is already in my application itself.
2. When I try to invoke this method: AccountManager.get(context).addAccount(accType,authToken,null,bundle,null, callback,null) , my authenticator is not getting invoked.

callback function is like this:
AccountManagerCallback<Bundle> callback = new AccountManagerCallback<Bundle>() {
public void run(AccountManagerFuture<Bundle> future) {
try {
Bundle bundle = future.getResult();
Log.d("AddAccountActivity", "Account: "
+ bundle.getString(AccountManager.KEY_ACCOUNT_NAME)
+ " has been created.");
return;
} catch (OperationCanceledException e) {
Log.e("", "addAccount was canceled");
} catch (IOException e) {
Log.e("", "addAccount failed: " + e);
} catch (AuthenticatorException e) {
Log.e("", "addAccount failed: " + e);
}
}
};

In Manifest entry is:
<service
android:name=".auth.AuthService"
android:exported="true">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
<meta-data android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator" />
</service>

Authenticator.xml is:
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="accType"
android:icon="@drawable/icon"
android:smallIcon="@drawable/icon"
android:label="@string/label"
/>

3. ContentResolver.requestSync(null,authority,null); is also not working to invoke my service.

I am using only "test.authority" value all over for sync authority.

Kindly give me some pointer for above.

Thanks a lot in advance !!
KRC
Freshman
Freshman
 
Posts: 3
Joined: Fri Jan 23, 2009 10:38 am

Top

Return to General

Who is online

Users browsing this forum: No registered users and 5 guests