Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. /*
  2. *
  3. * The login params need to handle users with multiple accounts under the same username.
  4. *
  5. * Since Android's AccountManager does not allow multiple accounts per username, I had
  6. * to create a hack which joins and splits the username on a delimiter to serialize the
  7. * data and retrieve the account number for users with multiple accounts. I chose the @
  8. * sign as a delimiter because e-mail addresses have VERY few invalid characters in
  9. * the account name part of the address.
  10. *
  11. * If the user has multiple accounts, we need to create each one in AccountManager.
  12. *
  13. * */
  14.  
  15. String[] accountParts = account.name.split("@");
  16. numParts = accountParts.length;
  17. if (numParts<2) {
  18. Log.wtf(Config.TAG, "Username split produced too few parts. WTF.");
  19. return null;
  20. }
  21. String email = accountParts[0] + "@" + accountParts[1];
  22.  
  23. if (numParts==3) {
  24. String account_id = accountParts[2];
  25. } else if (numParts>3) {
  26. Log.wtf(Config.TAG, "Username split produced too many parts. WTF.");
  27. return null;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement