对模拟器的作品,但不是在设备单点登录 [英] Single sign on works on emulator but not on device

查看:145
本文介绍了对模拟器的作品,但不是在设备单点登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Facebook的登录有一个非常恼人的问题。
在模拟器上运行的时候,却试图利用它在实际设备上时,会导致发生以下IT工作完全正常:
我看到Facebook页面加载,几秒钟,然后什么都没有。

I'm having a very annoying problem using Facebook's sign-on. It works perfectly fine when running on an emulator, but when trying to use it on an actual device causes the following to happen: I see the facebook page loading, for a few seconds, and then nothing.

_facebook = new Facebook(Common.APP_ID);
_facebook.authorize(this, new DialogListener() {
    @Override
    public void onComplete(Bundle values) {
        try {
            JSONObject json = new JSONObject(_facebook.request("me"));
            String id = json.getString("id");
            String token = _facebook.getAccessToken();
            Log.w("facebook", id);
            Log.w("facebook", token);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    @Override
    public void onFacebookError(FacebookError error) {
        Log.w("facebook", "onFacebookError");
    }
    @Override
    public void onError(DialogError e) {
        Log.w("facebook", "onError");
    }
    @Override
    public void onCancel() {
        Log.w("facebook", "onCancel");
    }
});

我没有得到任何的日志说什么是错的,它没有任何的的onError 方法,无所不为。只需进行如常。
我已经按照网上的一切所写的,我已经添加使用密钥工具,将应用页面得到的本机应用程序ID,并且仍然 - NADA

I get no logs saying anything is wrong, it does not stop at any of the onError methods, nothing. Just carries on as usual. I've followed everything written online, I've added the native app ID gotten using the keytool to the app page, and still - NADA.

任何帮助(即使是一个解决方法)将大大appriciated!
谢谢

Any help (even a workaround) would be greatly appriciated! Thanks

推荐答案

由于@harism没有张贴他的批评是一个答案,
我想我会至少要对这个问题的答案。

Since @harism isn't posting his comment as an answer, I figured I would at least to have an answer on this question.

我错过了有这块code的

What I missed was having this piece of code

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

    _facebook.authorizeCallback(requestCode, resultCode, data);
}

为什么它会在没有它,但不能在实际设备上的模拟器是什么我不能完全肯定,但使用这种code不会导致SSO到我的设备上工作。

Why it would on an emulator without it but not on an actual device is something I'm not entirely sure, but using this code does cause the SSO to work on my device.

这篇关于对模拟器的作品,但不是在设备单点登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆