0
我想用Facebook登錄,登錄後我想獲得照片許可。不過,我只是得到公衆的個人資料。爲什麼它不檢索用戶照片的權限?Facebook沒有得到任何權限,除了公共個人資料
private void registerFacebook()
{
isFetchingFB = false;
mDialog.show();
Session.openActiveSession(this, true, new Session.StatusCallback()
{
@Override
public void call(final Session session, SessionState state, Exception exception)
{
if (session.isOpened())
{
getUserPhotosPermission(session);
}
else
{
mDialog.dismiss();
if (!session.isOpened())
Log.d("FACEBOOK", "!session.isOpened()");
else
Log.d("FACEBOOK", "isFetching");
}
}
});
}
private void getUserPhotosPermission(Session session)
{
List<String> permissions = new ArrayList<String>();
permissions.add("user_photos");
final Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(this, permissions)
.setRequestCode(ACTIVITY_RESULT_FB);
session.requestNewReadPermissions(newPermissionsRequest);
}
private void getUserMeRequest()
{
final Session session = Session.getActiveSession();
Request getMe = Request.newMeRequest(session, new GraphUserCallback()
{
@Override
public void onCompleted(GraphUser user, Response response)
{
if (user != null && !isFetchingFB)
{
isFetchingFB = true;
org.json.JSONObject graphResponse = response.getGraphObject().getInnerJSONObject();
String name = graphResponse.optString("name");
String id = graphResponse.optString("id");
callFacebookApi(name, id, session.getAccessToken());
}
else
mDialog.dismiss();
}
});
getMe.executeAsync();
}