GenericAccountService: Allow arbitrary account types

Removed hardcoded account type from GenericAccountService, to support
better reusability between projects.

Change-Id: I95f0626cebceb097fa0136c85ac0ef998987b3a6
diff --git a/common/src/java/com/example/android/common/accounts/ b/common/src/java/com/example/android/common/accounts/
index 9480023..0cd499a 100644
--- a/common/src/java/com/example/android/common/accounts/
+++ b/common/src/java/com/example/android/common/accounts/
@@ -29,17 +29,23 @@
 public class GenericAccountService extends Service {
     private static final String TAG = "GenericAccountService";
-    private static final String ACCOUNT_TYPE = "";
-    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 @@
         // 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);