get google Account - Android Account

Android examples for Account:Google Account

Description

get google Account

Demo Code


//package com.book2s;
import android.accounts.Account;
import android.accounts.AccountManager;

public class Main {
    private static Account getAccount(AccountManager accountManager) {
        Account[] accounts = accountManager.getAccountsByType("com.google");
        Account account;//  ww w.  jav a  2s . c  o m
        if (accounts.length > 0) {
            account = accounts[0];
        } else {
            account = null;
        }
        return account;
    }
}

Related Tutorials