Java 类com.google.android.gms.common.AccountPicker 实例源码

项目:edx-app-android    文件:GoogleOauth2.java   
private void pickUserAccount() {
    try {
        String[] accountTypes = new String[]{"com.google"};
        Intent intent = AccountPicker.newChooseAccountIntent(null, null,
                accountTypes, true, null, null, null, null);
        if ( activity == null )
            return;
        // check if play-services are installed
        int result = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity);
        if (ConnectionResult.SUCCESS == result) {
            activity.startActivityForResult(intent, REQUEST_CODE_PICK_ACCOUNT);
            logger.debug("Launching google account picker ...");
        } else {
            // display user friendly error message
            logger.debug("Play services are missing ...");
            GooglePlayServicesUtil.getErrorDialog(result, activity, 100).show();
        }
    } catch (ActivityNotFoundException ex) {
        logger.debug("Google-play-services are missing? cannot login by google");
    }
}
项目:coasy    文件:CourseListFragment.java   
@Override
public void onResume() {
    super.onResume();

    if (!SettingsUtil.isAccountSelected(getActivity())) {

        final int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity().getApplicationContext());
        if (status == ConnectionResult.SUCCESS) {

            startActivityForResult(
                    AccountPicker.newChooseAccountIntent(null, null, new String[] { GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE }, false, null, null, null, null),
                    UserSettingsActivity.REQUEST_CODE_ACCOUNT_NAME);

        } else {

            GooglePlayServicesUtil.getErrorDialog(status, getActivity(), UserSettingsActivity.REQUEST_CODE_PLAY_SERVICES_NOT_AVAILABLE).show();
        }
    }
    initLoader();

    getLoaderManager().restartLoader(ILoader.COURSES_LOADER_ID, null, this);
}
项目:coasy    文件:StudentListFragment.java   
@Override
public void onResume() {
    super.onResume();

    if (!SettingsUtil.isAccountSelected(getActivity())) {

        final int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity().getApplicationContext());
        if (status == ConnectionResult.SUCCESS) {

            startActivityForResult(
                    AccountPicker.newChooseAccountIntent(null, null, new String[] { GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE }, false, null, null, null, null),
                    UserSettingsActivity.REQUEST_CODE_ACCOUNT_NAME);

        } else {

            GooglePlayServicesUtil.getErrorDialog(status, getActivity(), UserSettingsActivity.REQUEST_CODE_PLAY_SERVICES_NOT_AVAILABLE).show();
        }
    }

    getLoaderManager().restartLoader(ILoader.STUDENTS_LOADER_ID, null, this);
}
项目:coasy    文件:UserSettingsActivity.java   
@Override
public boolean onPreferenceClick(Preference preference) {

    if (preference.getKey().equals(getString(R.string.btnSelectGoogleAccount_key))) {

        final int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity().getApplicationContext());
        if (status == ConnectionResult.SUCCESS) {

            startActivityForResult(AccountPicker.newChooseAccountIntent(SettingsUtil.getSelectedGoogleAccount(getActivity()), null,
                    new String[] { GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE }, false, null, null, null, null), UserSettingsActivity.REQUEST_CODE_ACCOUNT_NAME);
            return true;

        } else {

            GooglePlayServicesUtil.getErrorDialog(status, getActivity(), UserSettingsActivity.REQUEST_CODE_PLAY_SERVICES_NOT_AVAILABLE).show();
        }

    }
    return true;
}
项目:conference-central-android-app    文件:MainActivity.java   
private void selectAccount() {
    Account[] accounts = Utils.getGoogleAccounts(this);
    int numOfAccount = accounts.length;
    switch (numOfAccount) {
        case 0:
            // No accounts registered, nothing to do.
            Toast.makeText(this, R.string.toast_no_google_accounts_registered,
                    Toast.LENGTH_LONG).show();
            break;
        case 1:
            mEmailAccount = accounts[0].name;
            performAuthCheck(mEmailAccount);
            break;
        default:
            // More than one Google Account is present, a chooser is necessary.
            // Invoke an {@code Intent} to allow the user to select a Google account.
            Intent accountSelector = AccountPicker.newChooseAccountIntent(null, null,
                    new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE}, false,
                    getString(R.string.select_account_for_access), null, null, null);
            startActivityForResult(accountSelector, ACTIVITY_RESULT_FROM_ACCOUNT_SELECTION);
    }
}
项目:titanium_google_auth_util    文件:TitaniumGoogleAuthUtilModule.java   
@Kroll.method
public void signin(KrollDict props)
{
    if (props.containsKey("success")) {
        successCallback = (KrollFunction) props.get("success");
    }
    if (props.containsKey("error")) {
        errorCallback = (KrollFunction) props.get("error");
    }


    String[] accountTypes = new String[] { GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE };
    Intent intent = AccountPicker.newChooseAccountIntent(null, null,
            accountTypes, false, null, null, null, null);

    Activity activity = TiApplication.getAppCurrentActivity();
    TiActivitySupport support = (TiActivitySupport) activity;
    requestCode = support.getUniqueResultCode();
    support.launchActivityForResult(intent, requestCode, this);

}
项目:iosched-reader    文件:AccountUtils.java   
/**
 * Enforce an active Google Account by checking to see if an active account is already set. If
 * it is not set then use the {@link AccountPicker} to have the user select an account.
 *
 * @param activity The context to be used for starting an activity.
 * @param activityResultCode The result to be used to start the {@link AccountPicker}.
 * @return Returns whether the user already has an active account registered.
 */
public static boolean enforceActiveGoogleAccount(Activity activity, int activityResultCode) {
    if (hasActiveAccount(activity)) {
        return true;
    } else {
        Intent intent = AccountPicker.newChooseAccountIntent(null, null,
                new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE},
                true, null, null, null, null);
        activity.startActivityForResult(intent, activityResultCode);
        return false;
    }
}
项目:financisto1-holo    文件:PreferencesActivity.java   
private void chooseAccount() {
    try {
        Account selectedAccount = getSelectedAccount();
        Intent intent = AccountPicker.newChooseAccountIntent(selectedAccount, null, ACCOUNT_TYPE, true,
                null, null, null, null);
        startActivityForResult(intent, CHOOSE_ACCOUNT);
    } catch (ActivityNotFoundException e) {
        Toast.makeText(this, R.string.google_drive_account_select_error, Toast.LENGTH_LONG).show();
    }
}
项目:smconf-android    文件:AccountUtils.java   
/**
 * Enforce an active Google Account by checking to see if an active account is already set. If
 * it is not set then use the {@link AccountPicker} to have the user select an account.
 *
 * @param activity The context to be used for starting an activity.
 * @param activityResultCode The result to be used to start the {@link AccountPicker}.
 * @return Returns whether the user already has an active account registered.
 */
public static boolean enforceActiveGoogleAccount(Activity activity, int activityResultCode) {
    if (hasActiveAccount(activity)) {
        return true;
    } else {
        Intent intent = AccountPicker.newChooseAccountIntent(null, null,
                new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE},
                true, null, null, null, null);
        activity.startActivityForResult(intent, activityResultCode);
        return false;
    }
}
项目:YouTubeUploader    文件:UploadVideoActivity.java   
/**
 * Pick up a Google account from the device. See http://developer.android.com/google/auth/http-auth.html.
 */
public void chooseAccount()
{
    String[] accountTypes = new String[]{"com.google"};
    Intent intent = AccountPicker.newChooseAccountIntent(null, null, accountTypes, false, null, null, null, null);
    startActivityForResult(intent, IntentRequestCode.REQUEST_ACCOUNT_PICKER);
}
项目:2015-Google-I-O-app    文件:AccountUtils.java   
/**
 * Enforce an active Google Account by checking to see if an active account is already set. If
 * it is not set then use the {@link AccountPicker} to have the user select an account.
 *
 * @param activity The context to be used for starting an activity.
 * @param activityResultCode The result to be used to start the {@link AccountPicker}.
 * @return Returns whether the user already has an active account registered.
 */
public static boolean enforceActiveGoogleAccount(Activity activity, int activityResultCode) {
    if (hasActiveAccount(activity)) {
        return true;
    } else {
        Intent intent = AccountPicker.newChooseAccountIntent(null, null,
                new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE},
                true, null, null, null, null);
        activity.startActivityForResult(intent, activityResultCode);
        return false;
    }
}
项目:yt-channel-list-android    文件:HomeActivity.java   
private void pickUserAccount() {
    String[] accountTypes = new String[]{"com.google"};
    Intent mIntent = AccountPicker.newChooseAccountIntent(null, null,
            accountTypes, false, null, null, null, null);
    if (mIntent.resolveActivity(getPackageManager()) != null) {
        startActivityForResult(mIntent, REQUEST_CODE_PICK_ACCOUNT);
    }
}
项目:FMTech    文件:AccountUtils.java   
/**
 * Enforce an active Google Account by checking to see if an active account is already set. If
 * it is not set then use the {@link AccountPicker} to have the user select an account.
 *
 * @param activity The context to be used for starting an activity.
 * @param activityResultCode The result to be used to start the {@link AccountPicker}.
 * @return Returns whether the user already has an active account registered.
 */
public static boolean enforceActiveGoogleAccount(Activity activity, int activityResultCode) {
    if (hasActiveAccount(activity)) {
        return true;
    } else {
        Intent intent = AccountPicker.newChooseAccountIntent(null, null,
                new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE},
                true, null, null, null, null);
        activity.startActivityForResult(intent, activityResultCode);
        return false;
    }
}
项目:flowzr-android-black    文件:FlowzrPreferencesActivity.java   
private void chooseFlowzrAccount() {
    try {
        Account selectedAccount = getFlowzrSelectedAccount();
        Intent intent = AccountPicker.newChooseAccountIntent(selectedAccount, null, ACCOUNT_TYPE, true,
                null, null, null, null);
        startActivityForResult(intent, CHOOSE_ACCOUNT);
    } catch (ActivityNotFoundException e) {
        Toast.makeText(this, R.string.google_drive_account_select_error, Toast.LENGTH_LONG).show();
    }
}
项目:flowzr-android-black    文件:BackupPreferencesActivity.java   
private void chooseAccount() {
    try {
        Account selectedAccount = getSelectedAccount();
        Intent intent = AccountPicker.newChooseAccountIntent(selectedAccount, null, ACCOUNT_TYPE, true,
                null, null, null, null);
        startActivityForResult(intent, CHOOSE_ACCOUNT);
    } catch (ActivityNotFoundException e) {
        Toast.makeText(this, R.string.google_drive_account_select_error, Toast.LENGTH_LONG).show();
    }
}
项目:Multi-Mania-app    文件:SettingsFragment.java   
private void askUserEmail() {
    try {
        Intent intent = AccountPicker.newChooseAccountIntent(null, null, new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE}, false, null, null, null, null);
        startActivityForResult(intent, REQUEST_CODE_EMAIL);
    } catch (ActivityNotFoundException e) {
        Log.e(TAG, e.getMessage());
    }
}
项目:Multi-Mania-app    文件:MainActivity.java   
private void askUserEmail() {
    try {
        Intent intent = AccountPicker.newChooseAccountIntent(null, null, new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE}, false, null, null, null, null);
        startActivityForResult(intent, SettingsFragment.REQUEST_CODE_EMAIL);
    } catch (ActivityNotFoundException e) {
    }
}
项目:JJCamera    文件:AccountUtils.java   
/**
 * Enforce an active Google Account by checking to see if an active account is already set. If
 * it is not set then use the {@link AccountPicker} to have the user select an account.
 *
 * @param activity The context to be used for starting an activity.
 * @param activityResultCode The result to be used to start the {@link AccountPicker}.
 * @return Returns whether the user already has an active account registered.
 */
public static boolean enforceActiveGoogleAccount(Activity activity, int activityResultCode) {
    if (hasActiveAccount(activity)) {
        return true;
    } else {
        Intent intent = AccountPicker.newChooseAccountIntent(null, null,
                new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE},
                true, null, null, null, null);
        activity.startActivityForResult(intent, activityResultCode);
        return false;
    }
}
项目:android-picasa-client    文件:PicasaClient.java   
/**
 * onActivityResult will be called either in the Activity/Fragment depending on whether a Fragment is attached.
 */
public void pickAccount() {
    String[] accountTypes = new String[]{ACCOUNT_TYPE_GOOGLE};
    Intent intent = AccountPicker.newChooseAccountIntent(null, null, accountTypes, false, null, null, null, null);
    if (mFragment != null) {
        mFragment.startActivityForResult(intent, REQUEST_ACCOUNT_PICKER);
    } else {
        mActivity.startActivityForResult(intent, REQUEST_ACCOUNT_PICKER);
    }
}
项目:Commandr-Android    文件:ReadUnreadGmailActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Shows Account Picker with google accounts if not stored in shared
    // preferences
    sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    Boolean accountFound = false;
    if (sharedPrefs.contains("gmailId")) {
        Account[] accounts = AccountManager.get(this)
                .getAccounts();
        accountName = sharedPrefs.getString("gmailId", null);
        for (Account a : accounts) {
            if (a.type.equals(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE)
                    && a.name.equals(accountName)) {
                accountFound = true;
                new getAuthToken().execute();
                break;
            }
        }
    }

    if (!accountFound) {
        Intent googlePicker = AccountPicker.newChooseAccountIntent(null,
                null, new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE},
                true, null, null, null, null);
        startActivityForResult(googlePicker, 1);
    }

}
项目:Cordova-Google-Play-Token    文件:GooglePlayToken.java   
private void pickUserAccount (CallbackContext callbackContext) {
 tryConnectCallback = callbackContext;
 String[] accountTypes = new String[]{"com.google"};
 Intent intent = AccountPicker.newChooseAccountIntent (null, null, accountTypes, false, null, null, null, null);
 doSetResultCallBack ();
 cordova.getActivity().startActivityForResult (intent, REQUEST_CODE_PICK_ACCOUNT);
}
项目:CloudMemeAndroid    文件:MainActivity.java   
/**
 * Method to request the user choose an account.
 */
private boolean triggerAccountSelection() {
    if (!checkGooglePlayServicesAvailable()) {
        return false;
    }
    Intent intent = AccountPicker.newChooseAccountIntent(null, null,
            new String[]{"com.google"}, false, getString(R.string.auth_description),
            null, null, null);
    startActivityForResult(intent, REQ_CHOOSE_ACCOUNT);
    return true;
}
项目:PortalWaitingList    文件:AuthActivity.java   
/**
 * Show the dialog for user to select one Google Account
 */
private void pickUserAccount() {
    String[] accountTypes = new String[]{"com.google"};
    Intent intent = AccountPicker.newChooseAccountIntent(null, null,
            accountTypes, false, null, null, null, null);
    startActivityForResult(intent, REQUEST_CODE_PICK_ACCOUNT);
}
项目:XamarinAdmobTutorial    文件:HelloActivity.java   
/** Starts an activity in Google Play Services so the user can pick an account */
private void pickUserAccount() {
    String[] accountTypes = new String[]{"com.google"};
    Intent intent = AccountPicker.newChooseAccountIntent(null, null,
            accountTypes, false, null, null, null, null);
    startActivityForResult(intent, REQUEST_CODE_PICK_ACCOUNT);
}
项目:ToDo    文件:UserInformation.java   
/**
 * pick a user account with the request id {@link com.rockyniu.todolist.util.Constance.REQUEST_USER_PICKER}
 */
private void onUserPicker(Activity activity) {
    Intent intent = AccountPicker.newChooseAccountIntent(null, null,
            new String[] { GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE }, true,
            null, null, null, null);
    try {
        activity.startActivityForResult(intent, Constance.REQUEST_USER_PICKER);
    } catch (Exception e) {
        ToastHelper.showErrorToast(activity, activity.getResources().getString(R.string.fail_to_add_new_user));
    }
}
项目:android-shared    文件:AccountUtils.java   
/**
 * @param activity    {@link Activity} used to start the account picker activity.
 * @param account     The currently selected {@link Account}.
 * @param requestCode If >= 0, this code will be returned in onActivityResult() when the activity exits.
 * @param accountType The type of accounts to choose from.
 */
public static void startAccountPicker(final Activity activity, final Account account, final int requestCode,
                                      final Bundle options, final String... accountType) {
    final Intent intent =
            AccountPicker.newChooseAccountIntent(account, null, accountType, true, null, null, null, options);

    activity.startActivityForResult(intent, requestCode);
}
项目:HereAStory-Android    文件:HelloActivity.java   
/** Starts an activity in Google Play Services so the user can pick an account */
private void pickUserAccount() {
    String[] accountTypes = new String[]{"com.google"};
    Intent intent = AccountPicker.newChooseAccountIntent(null, null,
            accountTypes, false, null, null, null, null);
    startActivityForResult(intent, REQUEST_CODE_PICK_ACCOUNT);
}
项目:activent    文件:HelloActivity.java   
/** Starts an activity in Google Play Services so the user can pick an account */
private void pickUserAccount() {
    String[] accountTypes = new String[]{"com.google"};
    Intent intent = AccountPicker.newChooseAccountIntent(null, null,
            accountTypes, false, null, null, null, null);
    startActivityForResult(intent, REQUEST_CODE_PICK_ACCOUNT);
}
项目:MarkTimeJS    文件:ChromeIdentity.java   
private void launchAccountChooserAndCallback(CordovaArgs cordovaArgsToSave, CallbackContext callbackContextToSave) {
    // Check if Google Play Services is available.
    int availabilityCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this.cordova.getActivity());
    if (availabilityCode == ConnectionResult.SUCCESS) {
        this.savedCordovaArgs = cordovaArgsToSave;
        this.savedCallbackContext = callbackContextToSave;
        this.savedContent  = true;

        // The "google.com" filter accepts both Google and Gmail accounts.
        Intent intent = AccountPicker.newChooseAccountIntent(null, null, new String[]{"com.google"}, false, null, null, null, null);
        this.cordova.startActivityForResult(this, intent, ACCOUNT_CHOOSER_INTENT);
    } else {
        callbackContextToSave.error(GOOGLE_PLAY_SERVICES_UNAVAILABLE);
    }
}
项目:MarkTimeJS    文件:ChromeIdentity.java   
private void launchAccountChooserAndCallback(CordovaArgs cordovaArgsToSave, CallbackContext callbackContextToSave) {
    // Check if Google Play Services is available.
    int availabilityCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this.cordova.getActivity());
    if (availabilityCode == ConnectionResult.SUCCESS) {
        this.savedCordovaArgs = cordovaArgsToSave;
        this.savedCallbackContext = callbackContextToSave;
        this.savedContent  = true;

        // The "google.com" filter accepts both Google and Gmail accounts.
        Intent intent = AccountPicker.newChooseAccountIntent(null, null, new String[]{"com.google"}, false, null, null, null, null);
        this.cordova.startActivityForResult(this, intent, ACCOUNT_CHOOSER_INTENT);
    } else {
        callbackContextToSave.error(GOOGLE_PLAY_SERVICES_UNAVAILABLE);
    }
}
项目:appengine-endpoints-helloendpoints-android    文件:MainActivity.java   
/**
 * This method is invoked when the "Sign In" button is clicked. See activity_main.xml for the
 * dynamic reference to this method.
 */
public void onClickSignIn(View view) {
  TextView emailAddressTV = (TextView) view.getRootView().findViewById(id.email_address_tv);
  // Check to see how many Google accounts are registered with the device.
  int googleAccounts = AppConstants.countGoogleAccounts(this);
  if (googleAccounts == 0) {
    // No accounts registered, nothing to do.
    Toast.makeText(this, R.string.toast_no_google_accounts_registered,
        Toast.LENGTH_LONG).show();
  } else if (googleAccounts == 1) {
    // If only one account then select it.
    Toast.makeText(this, R.string.toast_only_one_google_account_registered,
        Toast.LENGTH_LONG).show();
    AccountManager am = AccountManager.get(this);
    Account[] accounts = am.getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
    if (accounts != null && accounts.length > 0) {
      // Select account and perform authorization check.
      emailAddressTV.setText(accounts[0].name);
      mEmailAccount = accounts[0].name;
      performAuthCheck(accounts[0].name);
    }
  } else {
    // More than one Google Account is present, a chooser is necessary.

    // Reset selected account.
    emailAddressTV.setText("");

    // Invoke an {@code Intent} to allow the user to select a Google account.
    Intent accountSelector = AccountPicker.newChooseAccountIntent(null, null,
        new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE}, false,
        "Select the account to access Google Compute Engine API.", null, null, null);
    startActivityForResult(accountSelector,
        ACTIVITY_RESULT_FROM_ACCOUNT_SELECTION);
  }

}
项目:gplus-haiku-client-android    文件:MainActivity.java   
/**
 * Begin the non-immediate sign in flow
 */
private void beginSignInFlow() {
    setProgressBarIndeterminateVisibility(true);
    HaikuSession.State state = mHaikuPlusSession.checkSessionState(true);
    mSignInClicked = true;

    if (state == HaikuSession.State.UNAUTHENTICATED) {
        Intent intent = AccountPicker.newChooseAccountIntent(
                null, null, new String[]{"com.google"},
                false, null, null, null, null);
        startActivityForResult(intent, REQ_CHOOSE_ACCOUNT);
    } else {
        mGoogleApiClient.connect();
    }
}
项目:jump.android    文件:MainActivity.java   
private void googlePickUserAccount() {

        String[] accountTypes = new String[]{"com.google"};
        Intent intent = AccountPicker.newChooseAccountIntent(null, null,
                accountTypes, false, null, null, null, null);
        startActivityForResult(intent, GOOGLE_REQUEST_CODE_PICK_ACCOUNT);

    }
项目:chat.android    文件:MainActivity.java   
/**
 * Starts an activity in Google Play Services so the user can pick an
 * account
 */
private void pickUserAccount() {
    String[] accountTypes = new String[] { "com.google" };
    Intent intent = AccountPicker.newChooseAccountIntent(null, null,
            accountTypes, false, null, null, null, null);
    startActivityForResult(intent, REQUEST_CODE_PICK_ACCOUNT);
}
项目:SignIn-Android    文件:GoogleLoginActivity.java   
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.google_login);

    mKinveyClient = ((UserLogin) getApplication()).getKinveyService();
    mAccountManager = AccountManager.get(this);

    Intent intent = AccountPicker.newChooseAccountIntent(null, null,
            new String[] { "com.google" }, false, null, null, null, null);
    startActivityForResult(intent, GPLAY_REQUEST_CODE);
}
项目:RockPaperScissors    文件:MainActivity.java   
@Override
public void onClick(View view) {
    if (view == findViewById(R.id.add_account_button)) {

        Intent intent = AccountPicker.newChooseAccountIntent(null, null,
                new String[] { GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE }, false,
                null, null, null, null);
        try{
            startActivityForResult(intent, REQUEST_ACCOUNT_PICKER);
        } catch (Exception e){
            checkGooglePlaySerViceAvailable(MainActivity.this);
        }
    }
}
项目:AndroidAppDeployer    文件:ErrorReporter.java   
@Override
public void onClick(View v) {
    int viewId = v.getId();
    switch (viewId) {
    case R.id.error_button:
        if (mLastStatus.isError() && mLastStatus.isCustomIssue()) {
            String error = mLastStatus.getMsgObjectAsStringOrThrow();
            if (DownloadService.STATE_TOKEN_INVALID.equals(error)) {
                new AuthAsyncTask(mActivity, mRefreshUri).execute();
            } else if (DownloadService.STATE_REAUTHORIZE.equals(error)) {
                Intent intent = AccountPicker.newChooseAccountIntent(null,
                        null, new String[] { "com.google" }, false, null,
                        null, null, null);
                mActivity.startActivityForResult(intent,
                        REQUEST_PICK_ACCOUNT);
            } else if (DownloadService.STATE_UNSUPPORTED_DEVICE
                    .equals(error)) {
                int connectionResult = GooglePlayServicesUtil
                        .isGooglePlayServicesAvailable(mActivity);
                checkState(connectionResult != ConnectionResult.SUCCESS);
                Dialog dialog = GooglePlayServicesUtil.getErrorDialog(
                        connectionResult, mActivity, REQUEST_SHOW_ERROR);
                dialog.show();
            } else {
                throw new RuntimeException("Unknown error: " + error);
            }
        } else {
            DownloadHelper.startAsyncDownload(mActivity,
                    DownloadService.ACTION_SYNC, mRefreshUri, null, true);
        }
        return;
    default:
        throw new RuntimeException();
    }
}
项目:CloudVisionAPI    文件:MainActivity.java   
private void pickUserAccount() {
    String[] accountTypes = new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE};
    Intent intent = AccountPicker.newChooseAccountIntent(null, null,
            accountTypes, false, null, null, null, null);
    startActivityForResult(intent, REQUEST_CODE_PICK_ACCOUNT);
}
项目:Eulen    文件:register.java   
public void selectAccount(View view) { //handle click for Google Account edit text
    Intent googlePicker = AccountPicker.newChooseAccountIntent(null, null, new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE},
            true, null, null, null, null);

    startActivityForResult(googlePicker, REQUEST_CODE);
}
项目:MyDebts    文件:DebtsListActivity.java   
private void pickAccount() {
    Intent intent = AccountPicker.newChooseAccountIntent(
            null, null, new String[]{"com.google"},
            false, null, null, null, null);
    startActivityForResult(intent, SIGN_IN_RETURN_CODE);
}