List of usage examples for android.accounts AccountManager newChooseAccountIntent
@Deprecated static public Intent newChooseAccountIntent(Account selectedAccount, ArrayList<Account> allowableAccounts, String[] allowableAccountTypes, boolean alwaysPromptForAccount, String descriptionOverrideText, String addAccountAuthTokenType, String[] addAccountRequiredFeatures, Bundle addAccountOptions)
From source file:edu.sage.spark.ui.wizard.AccountConfigureFragment.java
@TargetApi(14) @Override/* w w w. j ava 2 s . com*/ public void onClick(View v) { if (v == mNextButton) { if (useSystemAccount) { onDeviceAccountSelected(settings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, ""), settings.getString(BeemApplication.ACCOUNT_SYSTEM_TYPE_KEY, "")); } else { String jid = mAccountJID.getText().toString() + serverURL;//almyz125 added our server to every user id that logs in. jid = StringUtils.parseBareAddress(jid); String password = mAccountPassword.getText().toString(); task = new ConnectionTestTask(); if (settings.getBoolean(BeemApplication.ACCOUNT_SPECIFIC_SERVER_KEY, false)) { String server = settings.getString(BeemApplication.ACCOUNT_SPECIFIC_SERVER_HOST_KEY, ""); String port = settings.getString(BeemApplication.ACCOUNT_SPECIFIC_SERVER_PORT_KEY, "5222"); task.execute(jid, password, server, port); } else task.execute(jid, password); } } else if (v == mManualConfigButton) { onManualConfigurationSelected(); } else if (v == mSelectAccountButton) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { Intent i = AccountManager.newChooseAccountIntent(null, null, new String[] { GOOGLE_ACCOUNT_TYPE }, true, null, null, null, null); startActivityForResult(i, SELECT_ACCOUNT_CODE); } } }
From source file:com.activiti.android.app.fragments.integration.alfresco.AlfrescoIntegrationFragment.java
private void launchAccountSelect() { Bundle b = new Bundle(); b.putString(AlfrescoIntentAPI.EXTRA_ALFRESCO_SHARE_URL, selectedIntegration.getShareUrl()); b.putString(AlfrescoIntentAPI.EXTRA_ALFRESCO_REPOSITORY_URL, selectedIntegration.getRepositoryUrl()); b.putString(AlfrescoIntentAPI.EXTRA_ALFRESCO_USERNAME, activitiAccount.getUsername()); Intent intent = AccountManager.newChooseAccountIntent(null, null, new String[] { AlfrescoIntegrator.ALFRESCO_ACCOUNT_TYPE }, true, null, null, null, b); startActivityForResult(intent, 10);//from ww w . j av a 2 s . c om }
From source file:com.einzig.ipst2.activities.MainActivity.java
/** * Search through accounts on the user's device now that we have permission to do so. *///ww w . j av a 2 s.co m public void gotAccountsPermission() { AccountManager manager = AccountManager.get(MainActivity.this); int numGoogAcct = 0; Account[] accountList = manager.getAccounts(); for (Account a : accountList) { if (a.type.equals("com.google")) { numGoogAcct++; } } if (numGoogAcct == 0) { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, ThemeHelper.getDialogTheme(this)); builder.setTitle(R.string.noaccountstitle); builder.setMessage(R.string.noaccountsmessage);//. Would you like to log in manually?") builder.setCancelable(true); builder.setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); builder.show(); } else { runOnUiThread(new Runnable() { @Override public void run() { findViewById(R.id.progress_view_mainactivity).setVisibility(View.VISIBLE); findViewById(R.id.gmail_login_button).setVisibility(View.INVISIBLE); } }); Intent intent = AccountManager.newChooseAccountIntent(null, null, new String[] { "com.google" }, false, null, null, null, null); startActivityForResult(intent, LOGIN_ACTIVITY_CODE); } }