For licensing purposes, I need to know the account of my Android Android server, which I believe is the same as the main account on their device. I can't find a method that does exactly that, so instead I request a list of google accounts and use the first one:
AccountManager manager = AccountManager.get(context); Account[] accounts = manager.getAccountsByType("com.google"); String account = ""; if (accounts != null && accounts.length > 0) account = accounts[0].name; return account;
This approach seems to work, but my question is: is the first account in the array returned by AccountManager.getAccountsByType("com.google") guarantee to always be the same as the Android Market account, or is there some ( non-trivial) exceptions?
Thanks in advance...
source share