aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/src/java/com/example/android/common/accounts/GenericAccountService.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/common/src/java/com/example/android/common/accounts/GenericAccountService.java b/common/src/java/com/example/android/common/accounts/GenericAccountService.java
index 9480023b..0cd499a8 100644
--- a/common/src/java/com/example/android/common/accounts/GenericAccountService.java
+++ b/common/src/java/com/example/android/common/accounts/GenericAccountService.java
@@ -29,17 +29,23 @@ import android.util.Log;
public class GenericAccountService extends Service {
private static final String TAG = "GenericAccountService";
- private static final String ACCOUNT_TYPE = "com.example.android.network.sync.basicsyncadapter";
- public static final String ACCOUNT_NAME = "sync";
+ public static final String ACCOUNT_NAME = "Account";
private Authenticator mAuthenticator;
/**
* Obtain a handle to the {@link android.accounts.Account} used for sync in this application.
*
+ * <p>It is important that the accountType specified here matches the value in your sync adapter
+ * configuration XML file for android.accounts.AccountAuthenticator (often saved in
+ * res/xml/syncadapter.xml). If this is not set correctly, you'll receive an error indicating
+ * that "caller uid XXXXX is different than the authenticator's uid".
+ *
+ * @param accountType AccountType defined in the configuration XML file for
+ * android.accounts.AccountAuthenticator (e.g. res/xml/syncadapter.xml).
* @return Handle to application's account (not guaranteed to resolve unless CreateSyncAccount()
* has been called)
*/
- public static Account GetAccount() {
+ public static Account GetAccount(String accountType) {
// Note: Normally the account name is set to the user's identity (username or email
// address). However, since we aren't actually using any user accounts, it makes more sense
// to use a generic string in this case.
@@ -47,7 +53,7 @@ public class GenericAccountService extends Service {
// This string should *not* be localized. If the user switches locale, we would not be
// able to locate the old account, and may erroneously register multiple accounts.
final String accountName = ACCOUNT_NAME;
- return new Account(accountName, ACCOUNT_TYPE);
+ return new Account(accountName, accountType);
}
@Override