List of usage examples for android.accounts AccountManager setUserData
public void setUserData(final Account account, final String key, final String value)
From source file:Main.java
/** * Set Salt saved to true//from w ww. j a va 2 s . co m * * @param account * @param accountManager */ public static void setSaltSaved(Account account, AccountManager accountManager) { accountManager.setUserData(account, PRIVATE_KEY_SALTSAVED, "true"); }
From source file:Main.java
public static void setAddWidget(AccountManager paramAccountManager, Account paramAccount) { paramAccountManager.setUserData(paramAccount, "account_add_widget", "YES"); }
From source file:Main.java
/** * Clears all saved Data about the Private Key * /*from w ww . ja va 2 s . c om*/ * @param account * @param acManager */ public static void clearPrivateKeyData(Account account, AccountManager acManager) { acManager.setUserData(account, PRIVATE_KEYSALT, null); acManager.setUserData(account, PRIVATE_PWDCHECK, null); acManager.setUserData(account, PRIVATE_PWD, null); acManager.setUserData(account, PRIVATE_KEY, null); acManager.setUserData(account, PRIVATE_KEY_SALTSAVED, null); }
From source file:Main.java
/** * Set user data to account// w w w. ja v a2 s . c o m * @param context context * @param account account * @param key key * @param value value */ public static void setUserData(Context context, Account account, String key, String value) { if (account == null) throw new IllegalArgumentException("account cannot be null"); AccountManager accountManager = AccountManager.get(context); accountManager.setUserData(account, key, value); }
From source file:edu.mit.mobile.android.livingpostcards.sync.AccountSyncService.java
/** * Sets the API URL stored in the account info to the desired URL * * @param context/*from w ww. ja v a 2 s.co m*/ * @param account * @param desiredUrl */ public static void setApiUrl(Context context, Account account, String desiredUrl) { final AccountManager am = AccountManager.get(context); am.setUserData(account, AuthenticationService.USERDATA_LOCAST_API_URL, desiredUrl); }
From source file:org.klnusbaum.udj.network.RESTProcessor.java
private static void checkVolume(Context context, AccountManager am, Account account, int volume) { if (Utils.getPlayerVolume(am, account) != volume) { am.setUserData(account, Constants.PLAYER_VOLUME_DATA, String.valueOf(volume)); Intent playerVolumeChangedBroadcast = new Intent(Constants.BROADCAST_VOLUME_CHANGED); playerVolumeChangedBroadcast.putExtra(Constants.PLAYER_VOLUME_EXTRA, volume); context.sendBroadcast(playerVolumeChangedBroadcast); }/*from ww w . j a v a2 s .c om*/ }
From source file:eu.nubomedia.nubomedia_kurento_health_communicator_android.kc_and_communicator.services.ChannelService.java
private static String getGCMRegId(Context ctx) { if (!checkPlayServices(ctx)) { return ""; }//from w w w . ja v a2 s. c o m gcm = GoogleCloudMessaging.getInstance(ctx); String regId = getRegistrationId(ctx); if (regId.isEmpty()) { String senderId = ctx.getResources().getString(R.string.gcm_sender_id); try { regId = gcm.register(senderId); } catch (IOException e) { e.printStackTrace(); return ""; } // Store gcm register id Account ac = AccountUtils.getAccount(ctx, false); if (ac == null) { log.warn("Cannot get account"); } AccountManager am = AccountManager.get(ctx); am.setUserData(ac, JsonKeys.GCM_ID, regId); } return regId; }
From source file:eu.nubomedia.nubomedia_kurento_health_communicator_android.kc_and_communicator.services.ChannelService.java
private static void storeRegistrationId(Context context, String regId, String channelId) { AccountManager am = (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE); Account ac = AccountUtils.getAccount(context, true); am.setUserData(ac, JsonKeys.REGISTER_ID, regId); am.setUserData(ac, JsonKeys.CHANNEL_ID, channelId); }
From source file:org.klnusbaum.udj.network.RESTProcessor.java
private static void checkPlaybackState(Context context, AccountManager am, Account account, String playbackState) {/*from w w w . ja v a 2 s .co m*/ int plState = Constants.PLAYING_STATE; if (playbackState.equals("playing")) { plState = Constants.PLAYING_STATE; } else if (playbackState.equals("paused")) { plState = Constants.PAUSED_STATE; } if (Utils.getPlaybackState(am, account) != plState) { am.setUserData(account, Constants.PLAYBACK_STATE_DATA, String.valueOf(plState)); Intent playbackStateChangedBroadcast = new Intent(Constants.BROADCAST_PLAYBACK_CHANGED); playbackStateChangedBroadcast.putExtra(Constants.PLAYBACK_STATE_EXTRA, plState); context.sendBroadcast(playbackStateChangedBroadcast); } }
From source file:ir.keloud.android.lib.common.accounts.AccountUtils.java
public static void saveClient(KeloudClient 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 ); }// ww w. j a va 2 s.com } }