List String permissions Arrays asList ParseFacebookUtils Permissions U

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
List<String> permissions = Arrays.asList(ParseFacebookUtils.Permissions.User.ABOUT_ME,
ParseFacebookUtils.Permissions.User.RELATIONSHIPS, ParseFacebookUtils.Permissions.User.BIRTHDAY,
ParseFacebookUtils.Permissions.User.EMAIL);
ParseFacebookUtils.link(mUser, permissions, getActivity(), new SaveCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
Request request = Request.newMeRequest(ParseFacebookUtils.getSession(), new Request.GraphUserCallback() {
@Override
public void onCompleted(final GraphUser facebookUser, Response response) {
dialog.dismiss();
if (facebookUser != null) {
mUser.put(ParseUtils.User.FACEBOOK_ID_KEY, facebookUser.getId());
mUser.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
facebookBt.setText("Logged as " + facebookUser.getName());
facebookBt.setEnabled(false);
downloadImage("http://graph.facebook.com/" + facebookUser.getId() + "/picture?type=large", avatarIv);
}
});
} else if (response.getError() != null) {
if ((response.getError().getCategory() == FacebookRequestError.Category.AUTHENTICATION_RETRY)
|| (response.getError().getCategory() == FacebookRequestError.Category.AUTHENTICATION_REOPEN_SESSION)) {
Log.e("Facebook parsing data", "The facebook session was invalidated.");
} else {
Log.e("Facebook parsing data", "Some other error: " + response.getError().getErrorMessage());
}
}
}
});
request.executeAsync();
} else {
performFacebookLogout();
dialog.dismiss();
Log.e(TAG, e.getMessage());
}
}
});