Code example for AccountManager

Methods: getAccountsByType

0
 
//Android 2.0 
class AndroidFunctionality05 extends AndroidFunctionality04 implements AndroidFunctionality { 
 
    private Account AccessOwnerInfo_getAccount(AccountManager accountManager) {
        Account[] accounts = accountManager.getAccountsByType("com.google");
        Account account;
        if (accounts.length > 0) {
            account = accounts[0];
        } else { 
            account = null;
        } 
        return account;
    } 
 
    public String AccessOwnerInfo_getEmail(Context context) {
        AccountManager accountManager = AccountManager.get(context);
        Account account = AccessOwnerInfo_getAccount(accountManager);
 
        if (account == null) {
            return null;