private static void getTwitterProfileInfo(AccessToken accessToken2) { try { String token = accessToken2.getToken(); Log.i(TAG, "token is " + token); mUserInfo.setExtra(token); long userId = accessToken2.getUserId(); mUserInfo.setTwitterId(String.valueOf(userId)); userObj = twitter.showUser(userId); mUserInfo.setProfilePic(userObj.getBiggerProfileImageURLHttps()); long cursor = -1; IDs freinds = twitter.getFriendsIDs(userObj.getId(), cursor); Log.d(TAG, "IDS:" + freinds.getIDs()); if (freinds.getIDs() != null) { StringBuilder builder = new StringBuilder(); builder.append(""); do { for (long i : freinds.getIDs()) { builder.append(i + ","); } } while (freinds.hasNext()); String freindIds = builder.toString(); Log.d("MSG:", "FND id:" + freindIds); if (freindIds.equals("")) { mUserInfo.setFriendsIds(freindIds); } else { freindIds = freindIds.substring(0, freindIds.length() - 1); mUserInfo.setFriendsIds(freindIds); } } if (userObj.getName() != null) { String name[] = userObj.getName().split(" "); /* * mUserInfo.setFirstName(name[0]); if (name[1] != null) { * mUserInfo.setLastName(name[1]); * * } */ if (name.length >= 2) { mUserInfo.setFirstName(name[0]); mUserInfo.setLastName(name[1]); } else if (name.length >= 1) { mUserInfo.setFirstName(name[0]); } } mUserInfo.setExpiresIn(String.valueOf(System.currentTimeMillis() + 600000)); } catch (TwitterException e) { Log.e(TAG, "Twitter login error"); } twitterHandler.isExit(String.valueOf(accessToken2.getUserId())); }
public void loginWithTwitter() { Log.i(TAG, "Logged in as Twitter"); mUserInfo = new SaveUserReqModel(); mUserInfo.setReqType(Request.TWITTER); if (isAppInstalled("com.twitter.android") && (Utils.hasJellyBean()) && !(Utils.hasKitKat())) { loginWithInstalledTwitter(); } else { loginWithTwitterWeb(); } }
public static void customDialogEvent(String val) { mUserInfo.setEmail(val); snagLogin(false); }