@Override public void onCompleted(GraphUser user, Response response) { // TODO Auto-generated method stub view.dismissLoading(); if (user == null) { view.showError(response.getError().getErrorMessage()); } else { l.d("facebook login result : " + user.getInnerJSONObject().toString()); SNSLoginData data = app().getUserConfig().loginData; data.nickName = user.getLastName() + user.getFirstName(); data.sns = EXTRA_AUTO_LOGIN_FACEBOOK; data.snsHome = user.getLink(); data.userId = (String) user.getProperty("email"); try { data.profileImage = ImageRequest.getProfilePictureUrl( user.getId(), FacebookModel.PROFILE_IMAGE_SIZE, FacebookModel.PROFILE_IMAGE_SIZE) .toString(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } prefModel.setAutoLogin(true); prefModel.setAutoLoginAction(EXTRA_AUTO_LOGIN_FACEBOOK); loginModel.loginSNS(data); } }
private void updateUI() { Session session = Session.getActiveSession(); boolean enableButtons = (session != null && session.isOpened()); // postStatusUpdateButton.setEnabled(enableButtons // || canPresentShareDialog); // postPhotoButton.setEnabled(enableButtons // || canPresentShareDialogWithPhotos); // pickFriendsButton.setEnabled(enableButtons); // pickPlaceButton.setEnabled(enableButtons); // if (enableButtons && user != null) { System.out.println("userid" + user.getId()); System.out.println("First name" + user.getFirstName()); System.out.println("email" + user.getProperty("email").toString()); System.out.println("Birthday:" + user.getBirthday()); System.out.println("GENDER" + user.getBirthday()); System.out.println("Location:" + user.getLocation()); System.out.println("JSON:" + user.getInnerJSONObject()); } else { System.out.println("Userinfo is null"); } }
private byte[] getByteArray(ArrayList<GraphUser> users) { // convert the list of GraphUsers to a list of String // where each element is the JSON representation of the // GraphUser so it can be stored in a Bundle ArrayList<String> usersAsString = new ArrayList<String>(users.size()); for (GraphUser user : users) { usersAsString.add(user.getInnerJSONObject().toString()); } try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); new ObjectOutputStream(outputStream).writeObject(usersAsString); return outputStream.toByteArray(); } catch (IOException e) { Log.e(TAG, "Unable to serialize users.", e); } return null; }