List of usage examples for com.google.api.client.googleapis.extensions.android.accounts GoogleAccountManager getAccounts
public Account[] getAccounts()
From source file:com.dogar.geodesic.activities.MainActivity.java
License:Apache License
private void initProfiles() { GoogleAccountManager googleAccountManager = AccountUtils.getGoogleAccountManager(this); for (Account account : googleAccountManager.getAccounts()) { profiles.add(new ProfileDrawerItem().withEmail(account.name)); }// w w w .j a v a 2s . c o m }
From source file:com.tachyondev.android.glass.looking.MainActivity.java
License:Apache License
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); GoogleAccountManager googleAccountManager = new GoogleAccountManager(this); Account[] googleAccounts = googleAccountManager.getAccounts(); if ((googleAccounts != null) && (googleAccounts.length > 0)) { email = googleAccounts[0].name;/*from ww w. jav a2 s . c o m*/ Log.d(TAG, "account: " + email); } getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON); // prefs = PreferenceManager.getDefaultSharedPreferences(this); // access_token = prefs.getString("Token", null); if (access_token == null) { new AuthTask().execute(); } else { insert(); } }