Code example for AccountManager

Methods: getUserData

0
     * 
     * @param account the account we're syncing 
     * @return the change high-water-mark 
     */ 
    private long getServerSyncMarker(Account account) {
        String markerString = accountManager.getUserData(account, SYNC_MARKER_KEY);
        if (!TextUtils.isEmpty(markerString)) {
            return Long.parseLong(markerString);
        } 
        return 0; 
    } 
 
    /** 
     * 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) {
        accountManager.setUserData(account, SYNC_MARKER_KEY, Long.toString(marker));
    }