Java 我可以在使用Facebook和其他字段(如fbUserName、fbEmail、fbPicture等)登录应用程序时获取联系人号码吗。?
我想在我的应用程序中使用facebook登录获取联系人号码,是否有任何方法获取联系人号码 我必须在我的应用程序中显示facebook用户的详细信息,如果用户没有添加他的联系人号码,那么我只需将ContactNo列设置为空,我想在其中显示基本的用户详细信息 我获取了如下用户详细信息:Java 我可以在使用Facebook和其他字段(如fbUserName、fbEmail、fbPicture等)登录应用程序时获取联系人号码吗。?,java,android,Java,Android,我想在我的应用程序中使用facebook登录获取联系人号码,是否有任何方法获取联系人号码 我必须在我的应用程序中显示facebook用户的详细信息,如果用户没有添加他的联系人号码,那么我只需将ContactNo列设置为空,我想在其中显示基本的用户详细信息 我获取了如下用户详细信息: //useLoginInformation() method is called from the CallbackManager listener to display details once the user
//useLoginInformation() method is called from the CallbackManager listener to display details once the user has successfully logged in
private void useLoginInformation(AccessToken accessToken) {
/**
Creating the GraphRequest to fetch user details
1st Param - AccessToken
2nd Param - Callback (which will be invoked once the request is successful)
**/
GraphRequest request = GraphRequest.newMeRequest(accessToken, new GraphRequest.GraphJSONObjectCallback() {
//OnCompleted is invoked once the GraphRequest is successful
@Override
public void onCompleted(JSONObject object, GraphResponse response) {
try {
String name = object.getString("name");
String email = object.getString("email");
String id=object.getString("id");
String image_url="https://graph.facebook.com/" + id + "/picture?type=normal";
//Send facebook user details from login activity to FacebookUserDetails activity
Intent intent=new Intent(LoginActivity.this,FacebookUserDetails.class);
intent.putExtra("facebookUsername",name);
intent.putExtra("facebookUserEmail",email);
intent.putExtra("facebookPic",image_url);
startActivity(intent);
progressBar.setVisibility(View.VISIBLE);
finish();
} catch (JSONException e) {
e.printStackTrace();
}
}
});
// We set parameters to the GraphRequest using a Bundle.
Bundle parameters = new Bundle();
parameters.putString("fields", "name,email,id,picture");
request.setParameters(parameters);
// Initiate the GraphRequest
request.executeAsync();
}