显示此警告:无会话请求需要令牌但缺少Facebook SSO集成的应用程序ID或客户端令牌

时间:2014-09-23 06:52:33

标签: android facebook

我正在开发facebook单点登录集成,但它显示此警告并且没有任何事情发生在按钮上单击它只显示进度对话框,然后退出应用程序后出现主屏幕。我没有在playstore上传apk,并希望让应用程序在调试模式下工作。请帮忙。 这是我的代码:

public class SplashActivityButton extends Activity {
        Button fb_login_button;
        public AsyncFacebookRunner mAsyncRunner;

        public Facebook facebook = new Facebook("my_appid");
        private SharedPreferences mPrefs;
        GraphUser user;
        boolean flag = true;
        List<String> permissions = new ArrayList<String>();


        Context context = this;

        private UiLifecycleHelper uiHelper;
        private final String PENDING_ACTION_BUNDLE_KEY = "my_package_name:PendingAction";

        private static final List<String> PERMISSIONS = Arrays.asList("publish_actions");

        private static final String PENDING_PUBLISH_KEY = "pendingPublishReauthorization";
        private boolean pendingPublishReauthorization = false;

        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_splashscreenbtn);
            fb_login_button = (Button) findViewById(R.id.fb_login_button);
            fb_login_button.setOnClickListener(new OnClickListener() {
                @SuppressWarnings("deprecation")
                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    // start Facebook Login
                    Global.flagLogin = true;
                    openActiveSession(SplashActivityButton.this, true, new Session.StatusCallback() {
                        // callback when session changes state
                        @Override
                        public void call(Session session, SessionState state, Exception exception) {
                            if (state.isOpened()) {
                                {
                                    Log.e("sessionopened", "true");
                                    Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
                                        @Override
                                        public void onCompleted(GraphUser user, Response response) {
                                            if (user != null) {
                                                String firstName = user.getFirstName();
                                                String lastName = user.getLastName();
                                                String id = user.getId();
                                                String email = user.getProperty("email").toString();

                                                Log.e("facebookid", id);
                                                Log.e("firstName", firstName);
                                                Log.e("lastName", lastName);
                                                Log.e("email", email);
                                                Global.guestuser = email;
                                                Global.getUserName = user.getName();

                                            }
                                        }
                                    });
                                }
                            }
                        }

                    }, permissions);


                }
            });


        }

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

0 个答案:

没有答案