List of usage examples for com.google.api.client.googleapis.extensions.android.gms.auth GoogleAccountCredential newChooseAccountIntent
public final Intent newChooseAccountIntent()
From source file:com.google.cloud.genomics.android.CredentialActivity.java
License:Apache License
protected void checkCredential() { GoogleAccountCredential credential = getCredential(this); if (credential.getSelectedAccountName() == null) { startActivityForResult(credential.newChooseAccountIntent(), REQUEST_ACCOUNT_PICKER); } else if (!isDeviceOnline(this)) { Toast.makeText(this, "No network connection available, this app won't show any data.", Toast.LENGTH_SHORT).show(); } else {//from w w w .j a va 2s.com credentialAvailable = true; handleCredential(); } }
From source file:com.meiste.tempalarm.ui.CurrentTemp.java
License:Apache License
@Override protected void onResume() { super.onResume(); mSyncStatusObserver.onStatusChanged(0); if (checkPlayServices()) { final GoogleAccountCredential credential = AccountUtils.getCredential(this); if (credential.getSelectedAccountName() != null) { GCMHelper.registerIfNeeded(getApplicationContext(), AppConstants.GCM_SENDER_ID, this); } else {//from w w w .ja v a2 s . co m startActivityForResult(credential.newChooseAccountIntent(), ACCOUNT_PICKER_REQUEST); } // Watch for sync state changes final int mask = ContentResolver.SYNC_OBSERVER_TYPE_PENDING | ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE; mSyncObserverHandle = ContentResolver.addStatusChangeListener(mask, mSyncStatusObserver); } }