List of usage examples for android.accounts AccountManager getUserData
public String getUserData(final Account account, final String key)
From source file:Main.java
public static String getUrl(Context context, Account account) { AccountManager manager = AccountManager.get(context); return manager.getUserData(account, USER_URL); }
From source file:Main.java
public static String getUserAvatar(Context context, Account account) { AccountManager manager = AccountManager.get(context); return manager.getUserData(account, USER_PIC); }
From source file:Main.java
/** * // w ww. ja v a 2 s . co m * @param account * @param accountManager * @return true if Salt was saved on the server */ public static boolean isSaltSaved(Account account, AccountManager accountManager) { return Boolean.valueOf(accountManager.getUserData(account, PRIVATE_KEY_SALTSAVED)); }
From source file:Main.java
public static int getLoginType(AccountManager paramAccountManager, Account paramAccount) { return Integer.parseInt(paramAccountManager.getUserData(paramAccount, "account_login_type")); }
From source file:Main.java
/** * Get user data of specified account/*from w ww .j a v a 2 s.c o m*/ * @param context context * @param account account * @param key key * @return user data string */ public static String getUserData(Context context, Account account, String key) { if (account == null) return null; AccountManager accountManager = AccountManager.get(context); return accountManager.getUserData(account, key); }
From source file:Main.java
/** * //from w ww . ja v a 2s . c om * Get Password-Check-Value or null * * @param account * @return Password-Check as Base64 Encoded or null */ public static String getPwdCheck(Account account, AccountManager accountManager) { String saltString = accountManager.getUserData(account, PRIVATE_PWDCHECK); if (TextUtils.isEmpty(saltString)) { saltString = null; } return saltString; }
From source file:Main.java
/** * //from w w w . j a va 2 s. c o m * Get Salt for current Private Key generation or return null. * * @param account * the account we're syncing * @return Salt as Base64 Encoded */ public static String getSalt(Account account, AccountManager accountManager) { String saltString = accountManager.getUserData(account, PRIVATE_KEYSALT); if (TextUtils.isEmpty(saltString)) { saltString = null; } return saltString; }
From source file:Main.java
/** * /*from w ww .j av a 2 s.com*/ * Get Private Key or return null. * * @param account * the account we're syncing * @return Private Key */ public static SecretKey getPrivateKey(Account account, AccountManager accountManager) { // TODO: Redesign more secure location to safe private key? String keyString = accountManager.getUserData(account, PRIVATE_KEY); SecretKey key = null; if (!TextUtils.isEmpty(keyString)) { key = new SecretKeySpec(Base64.decode(keyString, Base64.DEFAULT), "AES"); } return key; }
From source file:eu.nubomedia.nubomedia_kurento_health_communicator_android.kc_and_communicator.services.ChannelService.java
private static String getRegistrationId(Context context) { Account ac = AccountUtils.getAccount(context, false); if (ac == null) { log.warn("Cannot get account"); return ""; }//from w w w . ja v a 2s.c o m AccountManager am = AccountManager.get(context); String regID = am.getUserData(ac, JsonKeys.GCM_ID); if (regID == null) { regID = ""; } return regID; }
From source file:eu.nubomedia.nubomedia_kurento_health_communicator_android.kc_and_communicator.services.ChannelService.java
public static void createChannel(Context ctx) { String regId = getGCMRegId(ctx); if (regId.isEmpty()) { log.warn("regId is empty. It will get from GCM register"); return;/*from w w w.ja v a2s.c o m*/ } Account ac = AccountUtils.getAccount(ctx, false); AccountManager am = (AccountManager) ctx.getSystemService(Context.ACCOUNT_SERVICE); String userId; try { userId = am.getUserData(ac, JsonKeys.ID_STORED); } catch (Exception e) { log.error("Cannot get userId", e); return; } String json; try { json = registerInServer(ctx, regId, userId); } catch (Exception e) { log.error("Cannot send regId to server", e); return; } if (json == null) { log.error("Cannot get channelId"); return; } try { JSONObject obj = new JSONObject(json); String channelId = obj.getString(JsonKeys.CHANNEL_ID); storeRegistrationId(ctx, regId, channelId); Intent i = new Intent(ConstantKeys.BROADCAST_SERVER_REGISTER); ctx.sendBroadcast(i); } catch (JSONException e) { log.error("Error processing register result", e); } ctx.startService(new Intent(ctx.getApplicationContext(), CommandGetService.class)); }