嗨在這裏,我創建登錄與Facebook沒有登錄按鈕。它正常工作,但在關閉的圖表webkit登錄表單,它再次打開連續請求許可彈出。給我解決方案。用Facebook無登錄按鈕登錄Android
private void FacebookLogin() {
// TODO Auto-generated method stub
final Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(
this, Arrays.asList("email"));
Session openActiveSession = Session.openActiveSession(this, true,
new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state,
Exception exception) {
if (session.isOpened()) {
session.requestNewReadPermissions(newPermissionsRequest);
Request getMe = Request.newMeRequest(session,
new GraphUserCallback() {
@Override
public void onCompleted(GraphUser user,
Response response) {
if (user != null) {
org.json.JSONObject graphResponse = response
.getGraphObject()
.getInnerJSONObject();
String email = graphResponse
.optString("email");
String id = graphResponse
.optString("id");
}
}
});
getMe.executeAsync();
} else {
if (!session.isOpened())
Log.d("FACEBOOK", "!session.isOpened()");
else
Log.d("FACEBOOK", "isFetching");
}
}
});
}
@Override
protected void onActivityResult(int arg0, int arg1, Intent arg2) {
// TODO Auto-generated method stub
super.onActivityResult(arg0, arg1, arg2);
Session.getActiveSession().onActivityResult(this, arg0, arg1, arg2);
}
你是說,只要對話框關閉,它會再次打開? –
發佈整個片段代碼 –
檢查此https://developers.facebook.com/docs/facebook-login/android/v2.3 –