Friday, March 2, 2012

[android-developers] AccountManager object on Archos 101 Tablet

Hi all,

I currently have an app I'm beta testing and one of the test users has
an Archos 101 tablet. I'm implementing an in-app store and one of the
things I need is the account name they're using. I have logic to
handle if they've got multiple accounts, but I seem to be getting only
a null result from this code:

public String[] getAccountList(Activity activity) {
int numAccounts= 0;
AccountManager accountManager =
AccountManager.get(activity);
Account[] accounts =
accountManager.getAccountsByType("com.google");
numAccounts= accounts.length;
if (numAccounts< 1) {
return null;
}
String[] accountList = new String[numAccounts];
int i = 0;
for (Account account : accounts) {
accountList[i] = account.name;
i++;
}
return accountList;
}

The accountManager.getAccountsByType() method keeps returning no
results (same goes for getAccounts), so it just returns null. Is there
a step I'm missing to allow my app to get account information on 2.2.x
devices? The code works fine on a Toshiba Thrive (AT100) and the in-
app store functions as I expect.

Thanks!

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate