List of usage examples for android.accounts AccountManager setUserData
public void setUserData(final Account account, final String key, final String value)
From source file:com.owncloud.android.lib.common.accounts.AccountUtils.java
public static void saveClient(OwnCloudClient client, Account savedAccount, Context context) { // Account Manager AccountManager ac = AccountManager.get(context.getApplicationContext()); if (client != null) { String cookiesString = client.getCookiesString(); if (cookiesString != "") { ac.setUserData(savedAccount, Constants.KEY_COOKIES, cookiesString); // Log_OC.d(TAG, "Saving Cookies: "+ cookiesString ); }/*from w ww . j a v a 2 s . co m*/ } }
From source file:com.ntsync.android.sync.shared.SyncUtils.java
/** * Save Restrictions//from w ww.java 2s .com * * @param account * @param accountManager * @param restr * could be null, then Restriction-Info will be deleted */ public static void saveRestrictions(Account account, AccountManager accountManager, Restrictions restr) { String photoSupportStr = restr != null ? Boolean.toString(restr.isPhotoSyncSupported()) : null; accountManager.setUserData(account, SYNC_RESTRICTIONS_PHOTOSUPPORT, photoSupportStr); String maxContactsStr = restr != null ? String.valueOf(restr.getMaxContactCount()) : null; accountManager.setUserData(account, SYNC_RESTRICTIONS_MAXCONTACTS, maxContactsStr); String maxGroupStr = restr != null ? String.valueOf(restr.getMaxGroupCount()) : null; accountManager.setUserData(account, SYNC_RESTRICTIONS_MAXGROUPS, maxGroupStr); Date validDate = restr != null ? restr.getValidUntil() : null; accountManager.setUserData(account, SYNC_RESTRICTIONS_VALIDUNTIL, validDate != null ? String.valueOf(validDate.getTime()) : null); }
From source file:com.cerema.cloud2.lib.common.accounts.AccountUtils.java
public static void saveClient(OwnCloudClient client, Account savedAccount, Context context) { // Account Manager AccountManager ac = AccountManager.get(context.getApplicationContext()); if (client != null) { String cookiesString = client.getCookiesString(); if (!"".equals(cookiesString)) { ac.setUserData(savedAccount, Constants.KEY_COOKIES, cookiesString); // Log_OC.d(TAG, "Saving Cookies: "+ cookiesString ); }//from w w w.j ava 2 s. c o m } }
From source file:com.ntsync.android.sync.shared.SyncUtils.java
/** * Stores a Payment to make sure that the Payment will be verified and * processed./*from w w w .ja va2s . co m*/ * * @param account * @param accountManager * @param paymentConf * null: clear any stored information. * @param priceId * null: clear any stored information */ public static void savePayment(Account account, AccountManager accountManager, JSONObject paymentConf, UUID priceId) { String storeValue = priceId == null || paymentConf == null ? null : priceId.toString() + ";" + paymentConf.toString() + ";" + System.currentTimeMillis(); accountManager.setUserData(account, LAST_PAYMENT, storeValue); }
From source file:com.murrayc.galaxyzoo.app.LoginUtils.java
private static void copyPrefToAccount(final AccountManager mgr, final Account account, final String key, final String value) { //Note that this requires the AUTHENTICATE_ACCOUNTS permission on //SDK <=22. mgr.setUserData(account, key, value); }
From source file:com.ntsync.android.sync.syncadapter.SyncAdapter.java
/** * Allows to show the Contact not synced message again * //from w w w . ja va 2 s. c o m * @param context * @param account */ private static void unhideMaxContactMessage(Context context, Account account) { AccountManager acm = AccountManager.get(context); acm.setUserData(account, NOTIF_SHOWN_CONTACTS_SYNCED, null); }
From source file:com.ntsync.android.sync.shared.SyncUtils.java
/** * Set Sync-Result for an account.//from ww w .jav a 2 s .co m * * @param accountManager * @param account * @param syncResult */ public static void setSyncResult(AccountManager accountManager, Account account, AccountSyncResult syncResult) { String strVal = null; if (syncResult != null) { ObjectMapper mapper = new ObjectMapper(); try { strVal = mapper.writeValueAsString(syncResult); } catch (JsonProcessingException e) { LogHelper.logE(TAG, "Could not save AccountSyncResult for account: " + account, e); } } accountManager.setUserData(account, SYNC_STATE, strVal); }
From source file:com.ntsync.android.sync.client.NetworkUtilities.java
private static void setClientId(AccountManager accountManager, Account account, String clientId) { accountManager.setUserData(account, SYNC_CIENTID_KEY, clientId); }
From source file:org.klnusbaum.udj.EventActivity.java
private void doQuit() { AccountManager am = AccountManager.get(this); am.setUserData(account, Constants.EVENT_STATE_DATA, String.valueOf(Constants.LEAVING_EVENT)); Intent leaveEvent = new Intent(Intent.ACTION_DELETE, Constants.EVENT_URI, this, EventCommService.class); leaveEvent.putExtra(Constants.ACCOUNT_EXTRA, account); startService(leaveEvent);//from w w w . j a v a 2 s .co m setResult(Activity.RESULT_OK); finish(); }
From source file:org.klnusbaum.udj.network.PlayerCommService.java
private void setPlayerData(Intent intent, AccountManager am, Account account) { am.setUserData(account, Constants.PLAYER_NAME_DATA, intent.getStringExtra(Constants.PLAYER_NAME_EXTRA)); am.setUserData(account, Constants.PLAYER_HOSTNAME_DATA, intent.getStringExtra(Constants.PLAYER_OWNER_EXTRA)); am.setUserData(account, Constants.PLAYER_HOST_ID_DATA, intent.getStringExtra(Constants.PLAYER_OWNER_ID_EXTRA)); am.setUserData(account, Constants.PLAYER_LAT_DATA, String.valueOf(intent.getDoubleExtra(Constants.PLAYER_LAT_EXTRA, -100.0))); am.setUserData(account, Constants.PLAYER_LONG_DATA, String.valueOf(intent.getDoubleExtra(Constants.PLAYER_LONG_EXTRA, -100.0))); }