简体   繁体   English

FacebookSDK Request.newMeRequest onCompleted在JELLYBEAN上被调用,但不是KITKAT或LOLLIPOP

[英]FacebookSDK Request.newMeRequest onCompleted called on JELLYBEAN but not KITKAT or LOLLIPOP

This code results in the onCompleted method being called on Samsung JELLYBEAN but not on Motorola KITKAT or LG LOLLIPOP devices. 此代码导致在Samsung JELLYBEAN上调用onCompleted方法,但在Motorola KITKAT或LG LOLLIPOP设备上不会调用。 The log returns: W/Facebook test(20699): Facebook session status changed - OPENED - Exception: null on all devices. 日志返回: W/Facebook test(20699): Facebook session status changed - OPENED - Exception: null打开W/Facebook test(20699): Facebook session status changed - OPENED - Exception: null在所有设备上为W/Facebook test(20699): Facebook session status changed - OPENED - Exception: null

private class SessionStatusCallback implements Session.StatusCallback {
    @Override
    public void call(Session session, SessionState state, Exception exception) {
        String message = "Facebook session status changed - "
                + session.getState() + " - Exception: " + exception;                     
        Log.w("Facebook test", message);
        if (session.isOpened()) {
            Request.newMeRequest(session, new Request.GraphUserCallback() {
                @Override
                public void onCompleted(GraphUser user, Response response) {
                    Log.d("onCompleted",""); 
                }
            }).executeAsync();
        } 
    }
}

I have checked permissions and the hashes stored. 我已经检查了权限并存储了哈希。 This is my onActivityResult method: 这是我的onActivityResult方法:

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

UPDATE: I created a test project with identical code to the problem app. 更新:我使用与问题应用程序相同的代码创建了一个测试项目。 This project doesn't have the problem, which suggests it isn't a java issue. 该项目没有问题,这表明它不是Java问题。 The manifests are the same with regards to Facebook. 清单与Facebook相同。 I have the correct app_id in each case. 在每种情况下,我都有正确的app_id。 The settings of the apps on developers.facebook.com are the same except for package name, class name and key hash. 除了包名称,类名称和密钥哈希值之外,developers.facebook.com上应用程序的设置相同。

  • Go to developers.facebook.com 转到developers.facebook.com
  • Select your app 选择你的应用
  • Select Status and Review 选择状态并查看
  • Change "Do you want to make this app and all its live features available to the general public?" 更改“您是否要向公众提供此应用及其所有实时功能?” to NO (I waited about ten minutes at this point, which may not be necessary) 到否(此时我等待了大约十分钟,可能没有必要)
  • Then change the same setting back to YES 然后将相同设置更改回是

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM