AccountManager setUserData - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for AccountManager setUserData method.

This code example shows how to use the following methods:setUserData
  /** 
   * Write a complete set of unversioned Account data suitable for testing forward migration. 
   * @throws Exception 
   */ 
  public void populateAccountData(final AccountManager accountManager, final Account account) throws Exception {
    accountManager.setUserData(account, "account.guid", TEST_GUID);
    accountManager.setUserData(account, "account.clientName", TEST_CLIENT_NAME);
    accountManager.setUserData(account, "account.numClients", new Long(TEST_NUM_CLIENTS).toString());
  } 
 
  public void testMigrateGlobals0and1() throws Exception { 
    final SharedPreferences v0a = new MockSharedPreferences();
    final SharedPreferences v1a = new MockSharedPreferences();
    final SharedPreferences v0b = new MockSharedPreferences();
    final SharedPreferences v1b = new MockSharedPreferences();
 
    populateGlobalSharedPrefs(v0a);
 
    final int NUM_GLOBALS = 2;
    assertEquals(NUM_GLOBALS, v0a.getAll().size());

7
CodeRank
This code example shows how to use the following methods:setUserData
     * Save off the high-water-mark we receive back from the server. 
     * @param account The account we're syncing 
     * @param marker The high-water-mark we want to save. 
     */ 
    private void setServerSyncMarker(Account account, long marker) {
        mAccountManager.setUserData(account, SYNC_MARKER_KEY, Long.toString(marker));
    } 
} 
 
6
CodeRank
This code example shows how to use the following methods:getUserData, setUserData
 
public class Utils { 
	public static boolean getBooleanAccountData(AccountManager am, Account account, String key, boolean defaultValue) {
		boolean value = defaultValue;
		try { 
			String data = am.getUserData(account, key);
			if (data != null)
				value = Boolean.parseBoolean(data);
			else 
				am.setUserData(account, key, Boolean.toString(defaultValue));
		} catch (Exception ex) {
			try { 
				am.setUserData(account, key, Boolean.toString(defaultValue));
			} catch (Exception ex2) {
 
			} 
		} 
		return value;
	} 
} 
5
CodeRank
This code example shows how to use the following methods:setUserData
	public String getAccountType(final Account pAcc){
		return this.mAM.getUserData(pAcc, sKey_AccountType);
	} 
	 
	public void setAccountData(final Account pAcc, final String pDcto, final String pSegu, final String pTipo){
		this.mAM.setUserData(pAcc, sKey_Document, pDcto);
		this.mAM.setUserData(pAcc, sKey_Security, pSegu);
		this.mAM.setUserData(pAcc, sKey_AccountType, pTipo);
	} 
	 
 
} 
5
CodeRank
This code example shows how to use the following methods:setUserData
     *            The account we're syncing 
     * @param marker 
     *            The high-water-mark we want to save. 
     */ 
    private void setServerSyncMarker(Account account, long marker) {
        mAccountManager.setUserData(account, SYNC_MARKER_KEY, Long.toString(marker));
    } 
} 
3
CodeRank
This code example shows how to use the following methods:setUserData
     * Save off the high-water-mark we receive back from the server. 
     * @param account The account we're syncing 
     * @param marker The high-water-mark we want to save. 
     */ 
    private void setServerSyncMarker(Account account, long marker) {
        mAccountManager.setUserData(account, SYNC_MARKER_KEY, Long.toString(marker));
    } 
} 
5
CodeRank
This code example shows how to use the following methods:setUserData
     * 
     * @param account The account we're syncing 
     * @param marker The high-water-mark we want to save. 
     */ 
    private void setServerSyncMarker(Account account, long marker) {
        accountManager.setUserData(account, SYNC_MARKER_KEY, Long.toString(marker));
    } 
} 
3
CodeRank
This code example shows how to use the following methods:setUserData
     *            The account we're syncing 
     * @param marker 
     *            The high-water-mark we want to save. 
     */ 
    private void setServerSyncMarker(Account account, long marker) {
        mAccountManager.setUserData(account, SYNC_MARKER_KEY, Long.toString(marker));
    } 
} 
4
CodeRank
This code example shows how to use the following methods:setUserData
     * @param marker The high-water-mark we want to save. 
     */ 
    private void setServerSyncMarker(Account account, long marker) {
        Log.d(TAG, "setServerSyncMarker(): " + marker);
 
        mAccountManager.setUserData(account, SYNC_MARKER, Long.toString(marker));
    } 
 
} 
4
CodeRank
This code example shows how to use the following methods:setUserData
	 *            The account we're syncing 
	 * @param marker 
	 *            The high-water-mark we want to save. 
	 */ 
	private void setServerSyncMarker(Account account, long marker) {
		mAccountManager.setUserData(account, SYNC_MARKER_KEY, Long.toString(marker));
	} 
} 
4
CodeRank

Related AccountManager setUserData Questions & Answers:

setUserData Method Overview
Sets one userdata key for an account.
See Code Examples for other Android AccountManager Methods: