问题描述
要获得Android Market的帐户,我这样做的:
的AccountManager的AccountManager = AccountManager.get(本);
帐户[]帐户= accountManager.getAccountsByType(com.google);
。androidCheckout =应收[0] .name.trim()与toLowerCase();
使用我的手机,我的证书上面的语句是好的。我的帐户,以便掩盖:[email protected]
我的问题是:我知道帐户可以是Gmail或谷歌Apps帐户。而且也是谷歌Apps帐户可以有任何域名。在这种情况下,而不是@ gmail.com所以,可以有一切:根据不同的域名,比如cippalippa.us,该帐户可能是[email protected]。在这种情况下,上面的语句将仍然是确定??
这将仅适用于谷歌帐户的工作。您可以使用 getAccounts()
,而不是 getAccountsByType()
,现在帐户
将所有的同步帐户的列表。您可以通过方便地提取所需的帐户 accounts.name
和 accounts.type
To get the Android Market Account, I do so:
AccountManager accountManager = AccountManager.get(this);
Account[] accounts = accountManager.getAccountsByType("com.google");
androidCheckout = accounts[0].name.trim().toLowerCase();
With my phone and my credentials the above statement is fine.I've an account so masked: "[email protected]".
My question is: I know that the accounts can be either Gmail or Google Apps accounts. And also that Google Apps accounts can have any domain name. So, in this case, instead of @gmail.com there can be everything: depending on the domain name, for instance "cippalippa.us", the account could be "[email protected]". In this case, the above statement will still be ok??
it will work only for google accounts. You can use getAccounts()
instead getAccountsByType()
, now accounts
will be a list of all the sync accounts. You can easily extract your desired account using accounts.name
and accounts.type
这篇关于获取Android Market的帐户编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!