Facebook login not working if Facebook native application installed in device?

限于喜欢 提交于 2019-12-04 10:16:48
Straw Hat

I also Had same problem, I have added different key. See my Question Here

You will get more Information on this discussion Click here See The answer given By Abhishek Agrawal in that Link.

Add following code to your Activities onCreate and check which hashkey is sent by your app to facebook,

PackageInfo info;
    try {
        info = getPackageManager().getPackageInfo("com.example.yourpackagename", PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md;
            md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            String something = new String(Base64.encode(md.digest(), 0));
            //String something = new String(Base64.encodeBytes(md.digest()));
            Log.e("hash key", something);
        }
    } catch (NameNotFoundException e1) {
        Log.e("name not found", e1.toString());
    } catch (NoSuchAlgorithmException e) {
        Log.e("no such an algorithm", e.toString());
    } catch (Exception e) {
        Log.e("exception", e.toString());
    }
Abhishek Agarwal

First Check your hash key with these lines of code given by me at this link Facebook Integration in Android Application and if it is not working yet then please check that your Facebook Android Application in mobile is updated. If the application is not updated update your Facebook application and try to post.

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

Use this code in the activity where you call facebook login request.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!