List of usage examples for android.accounts Account Account
public Account(@NonNull Account other, @NonNull String accessId)
From source file:com.jefftharris.passwdsafe.sync.box.BoxProvider.java
@Override public Account getAccount(String acctName) { return new Account(acctName, SyncDb.BOX_ACCOUNT_TYPE); }
From source file:com.clearcenter.mobile_demo.mdStatusActivity.java
protected void onResume() { super.onResume(); observer = new mdDeviceSamplesObserver(observer_handler, this); ContentResolver resolver = getContentResolver(); resolver.registerContentObserver(mdDeviceSamples.CONTENT_URI, true, observer); updateData();/*w w w. j a va2s. c om*/ final Account account = new Account(account_nickname, mdConstants.ACCOUNT_TYPE); resolver.requestSync(account, mdContentProvider.AUTHORITY, new Bundle()); if (android.os.Build.VERSION.SDK_INT >= 11) { List<SyncInfo> syncs = resolver.getCurrentSyncs(); for (SyncInfo info : syncs) { Log.d(TAG, "account: " + info.account.name + ", authority: " + info.authority + ", startTime: " + info.startTime); } } }
From source file:com.ntsync.android.sync.activities.AccountListFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REGISTRATION_CODE && resultCode == Activity.RESULT_OK) { // Create Account for new Registration String username = data.getStringExtra(RegisterActivity.PARAM_USERNAME); String password = data.getStringExtra(RegisterActivity.PARAM_PWD); Account account = new Account(username, Constants.ACCOUNT_TYPE); Context context = this.getActivity(); AccountManager acm = AccountManager.get(context); SyncUtils.createAccount(context, account, acm, password); }//from w w w . j av a2 s.c om }
From source file:org.microg.gms.auth.login.LoginActivity.java
@SuppressLint("AddJavascriptInterface") @Override/*ww w .j a va 2s .c om*/ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); accountType = AuthConstants.DEFAULT_ACCOUNT_TYPE; accountManager = AccountManager.get(LoginActivity.this); inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); webView = createWebView(this); webView.addJavascriptInterface(new JsBridge(), "mm"); authContent = (ViewGroup) findViewById(R.id.auth_content); ((ViewGroup) findViewById(R.id.auth_root)).addView(webView); webView.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { Log.d(TAG, "pageFinished: " + url); if ("identifier".equals(Uri.parse(url).getFragment())) runOnUiThread(new Runnable() { @Override public void run() { webView.setVisibility(VISIBLE); } }); if ("close".equals(Uri.parse(url).getFragment())) closeWeb(false); if (url.startsWith(PROGRAMMATIC_AUTH_URL)) closeWeb(true); } }); if (getIntent().hasExtra(EXTRA_TOKEN)) { if (getIntent().hasExtra(EXTRA_EMAIL)) { AccountManager accountManager = AccountManager.get(LoginActivity.this); Account account = new Account(getIntent().getStringExtra(EXTRA_EMAIL), accountType); accountManager.addAccountExplicitly(account, getIntent().getStringExtra(EXTRA_TOKEN), null); retrieveGmsToken(account); } else { retrieveRtToken(getIntent().getStringExtra(EXTRA_TOKEN)); } } else { setMessage(R.string.auth_before_connect); setBackButtonText(android.R.string.cancel); setNextButtonText(R.string.auth_sign_in); } }
From source file:com.jefftharris.passwdsafe.sync.owncloud.OwncloudProvider.java
@Override public Account getAccount(String acctName) { return new Account(acctName, SyncDb.OWNCLOUD_ACCOUNT_TYPE); }
From source file:com.xandy.calendar.selectcalendars.SelectCalendarsSyncFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); mService = new AsyncQueryService(activity); Bundle bundle = getArguments();/*from w w w .ja va 2 s .c om*/ if (bundle != null && bundle.containsKey(Calendars.ACCOUNT_NAME) && bundle.containsKey(Calendars.ACCOUNT_TYPE)) { mAccount = new Account(bundle.getString(Calendars.ACCOUNT_NAME), bundle.getString(Calendars.ACCOUNT_TYPE)); } }
From source file:com.clearcenter.mobile_demo.mdMainActivity.java
public void onRemoveAccount() { Log.i(TAG, "Remove account: " + account_to_delete); final Account account = new Account(account_to_delete, mdConstants.ACCOUNT_TYPE); account_manager.removeAccount(account, new mdAccountManagerCallback(), null); }
From source file:com.pindroid.authenticator.AuthenticatorActivity.java
/** * Called when response is received from the server for confirm credentials * request. See onAuthenticationResult(). Sets the * AccountAuthenticatorResult which is sent back to the caller. * /*from w w w. ja va 2s . c om*/ * @param the confirmCredentials result. */ protected void finishConfirmCredentials(String authToken) { Log.i(TAG, "finishConfirmCredentials()"); final Account account = new Account(mUsername, Constants.ACCOUNT_TYPE); mAccountManager.setAuthToken(account, Constants.AUTHTOKEN_TYPE, authToken); final Intent intent = new Intent(); intent.putExtra(AccountManager.KEY_BOOLEAN_RESULT, authToken != null); intent.putExtra(AccountManager.KEY_AUTHTOKEN, authToken); setAccountAuthenticatorResult(intent.getExtras()); setResult(RESULT_OK, intent); finish(); }
From source file:org.sufficientlysecure.keychain.service.ContactSyncAdapterService.java
public static void requestContactsSync() { // if user has disabled automatic sync, do nothing boolean isSyncEnabled = ContentResolver.getSyncAutomatically( new Account(Constants.ACCOUNT_NAME, Constants.ACCOUNT_TYPE), ContactsContract.AUTHORITY); if (!isSyncEnabled) { return;// www .ja v a 2 s . c om } Bundle extras = new Bundle(); // no need to wait, do it immediately extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); ContentResolver.requestSync(new Account(Constants.ACCOUNT_NAME, Constants.ACCOUNT_TYPE), ContactsContract.AUTHORITY, extras); }
From source file:com.google.android.apps.mytracks.AbstractSendToGoogleActivity.java
@Override public void onChooseAccountDone() { String googleAccount = PreferencesUtils.getString(this, R.string.google_account_key, PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT); if (googleAccount == null || googleAccount.equals(PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT)) { return;/* w w w . j a v a 2 s . c om*/ } sendRequest.setAccount(new Account(googleAccount, Constants.ACCOUNT_TYPE)); if (sendRequest.isSendDrive() && sendRequest.isDriveSync() && sendRequest.isDriveSyncConfirm()) { new ConfirmSyncDialogFragment().show(getSupportFragmentManager(), ConfirmSyncDialogFragment.CONFIRM_SYNC_DIALOG_TAG); } else { onConfirmSyncDone(true); } }