Im integrated parse and facebook sdk to my project and its work and i get id and user name of facebook user my issue is i cannot get any thing else like email or gender or any other information even i add the permission for them.
this is permission :
private static final List<String> Permissions = Arrays.asList("public_profile","email","user_friends","user_birthday","user_location","user_relationships");
button click code :
Button mBtnFb=(Button)findViewById(R.id.mBtnFb);
mBtnFb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ParseFacebookUtils.logInWithReadPermissionsInBackground(MainActivity.this,Permissions , new LogInCallback() {
@Override
public void done(ParseUser user, ParseException err) {
if (user == null) {
Log.d("MyApp", "The user cancelled the Facebook login.");
} else if (user.isNew()) {
Log.d("MyApp", "User signed up and logged in through Facebook!");
getUserDetailsFromFB();
} else {
Log.d("MyApp", "User logged in through Facebook!");
getUserDetailsFromParse();
}
}
});
}
});
get user details from facebook:
public String name,email;
ParseUser parseUser=new ParseUser();
private void getUserDetailsFromFB() {
GraphRequest request = GraphRequest.newMeRequest(
AccessToken.getCurrentAccessToken(),
new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(
JSONObject object,
GraphResponse response) {
try {
String id=object.getString("id");
String name=object.getString("name");
String email=object.getString("email");
String gender=object.getString("gender");
String birthday=object.getString("birthday");
} catch (JSONException e) {
e.printStackTrace();
}
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "id,name,link,email");
request.setParameters(parameters);
request.executeAsync();
}
I get id and name only and any other info give me exception any suggestion ?
I had exactly the same issue, here's how I solved it:
This should then give your application the permission to retrieve the email address of the facebook user.
Hope this helps.
Regards, Nathanial
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments