Thanks in 开发者_如何学JAVAadvance
Yes, it is possible. Look at the Chrome to Phone application (http://code.google.com/p/chrometophone/). There they build a list of accounts from the String array generated like this:
ArrayList<String> accountNames = new ArrayList<String>();
Account[] accounts = AccountManager.get(this).getAccounts();
for (Account account : accounts) {
if (account.type.equals("com.google")) {
accountNames.add(account.name);
}
}
String[] result = new String[accountNames.size()];
accountNames.toArray(result);
After giving it some thought I think it just does't work this way. All the C2DM needs is 'existing connection' and I think there is only one connection no matter how many google accounts there are.
精彩评论