登录后,Facebook的seession关闭过程中的Andr​​oid过程中、seession、Facebook、Andr

由网友(致命的梦,不能再醒)分享简介:我正在开发Android应用程序需要的Facebook登录信息发布Facebook的意见。但是我就死在登录的,所以我也跟着教程在的https://developers.facebook.com/docs/tutorials/androidsdk/3.0/scrumptious/authenticate/但我发现stat...

我正在开发Android应用程序需要的Facebook登录信息发布Facebook的意见。但是我就死在登录的,所以我也跟着教程在的https://developers.facebook.com/docs/tutorials/androidsdk/3.0/scrumptious/authenticate/但我发现state.isCloced()==真登录后(Facebook的登录按钮也不会改变它的文本注销)。我看不出有任何理由,为什么它不工作。谁能帮我?

I'm developing android app which require facebook login for posting facebook comments. However I've got stuck on logging in. So I followed tutorial at https://developers.facebook.com/docs/tutorials/androidsdk/3.0/scrumptious/authenticate/ but I'm getting state.isCloced() == true after log in (facebook login button also does not change it's text to log out). I don't see any reason why it is not working. Can anyone help me?

到的定做教程中,我有片段:

Reffering to tutorial I have fragment:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
<com.facebook.widget.LoginButton
    android:id="@+id/login_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_marginBottom="30dp"
    android:layout_marginTop="30dp" />
</LinearLayout>

和我MainActivity:

And in my MainActivity:

    private UiLifecycleHelper uiHelper;
private Session.StatusCallback callback = new Session.StatusCallback() {
    @Override
    public void call(Session session, SessionState state, Exception exception)                 {
        onSessionStateChange(session, state, exception);
    }
};

    @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    uiHelper = new UiLifecycleHelper(this, callback);
    uiHelper.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
}



private void onSessionStateChange(Session session, SessionState state, Exception exception) {
    if (state.isOpened()) {
        Log.i("FacebookFragment", "State is opened");
    } else if (state.isClosed()) {
        Log.i("FacebookFragment", "State is closed");
    }
}

@Override
public void onResume() {
    super.onResume();
    uiHelper.onResume();
}

@Override
public void onPause() {
    super.onPause();
    uiHelper.onPause();
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    uiHelper.onActivityResult(requestCode, resultCode, data);
}

@Override
public void onDestroy() {
    super.onDestroy();
    uiHelper.onDestroy();
}

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    uiHelper.onSaveInstanceState(outState);
}

在我点击LoginButton,FB权限对话框弹出时,我点击确定,然后我看到全面进步吧,然后我再次看到登录按钮。在LogCat中仍是国家关闭:(

After I click LoginButton, fb permission dialog pops up, I click ok, then I see round progress bar and then I see login button again. In LogCat is still State is closed :(

我是不是做错了什么?或可能是因为被嵌套在另一个片段,片段与loginButton?

Am I doing something wrong? Or could it be because Fragment with loginButton is nested in another fragment?

我测试的设备与Android 4,本机FB应用程序安装。

I'm testing on device with android 4, native FB app installed.

感谢:)

推荐答案

好吧,我解决了这个问题,根据remote_app_id不匹配存储的ID例外,我找到答案的

阅读全文

相关推荐

最新文章