简体   繁体   中英

warning showing sessionless request in facebook sdk

I am creating a libgdx game and to add social features to the game I am adding Facebook SDK but I always get a warning in logcat stating: "Warning: Sessionless Request needs token but missing either application ID or client token.".

Firstly I tried to add Facebook feature as given on " http://rotatingcanvas.com/post-game-score-in-facebook-from-android/ " but later I came to know that Facebook class is now almost deprecated.

Then I wrote the code from scratch by looking at documentaion given on developers.facebook.com but it still shows same warning and later I used android-simple-facebook library to implement Facebook feature but still it showing same warning and also the access token is always empty.

What could possibly be the problem?

On my Facebook developer account I am using a test app and also a test user and trying to login to that test user through that test app. But it always shows the same problem , where I could be possibly wrong?? Thanks

It may be due to Session not completly setup. Possibly you are implementing the facebook sdk in a fragment, if so then onActivityResult in which you are to override in the fragment will not be called by the facebook sdk, rather it will call the onActivityResult of the Fragment Activity.. You should rather call the onActivityResult of the fragment from the fragment activity onActivityResult.

Remove onActivityResult from Fragment then add method on Activity page

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

It works for me !!!!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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