Facebook post is not working.

Hello

In my app there is a facility to post the scores on facebook.

The problem is on Android platform.

I used the

facebook.login( fbAppID, facebookListener, { “publish_stream” } ) 

local attachment = {

    message = “Hey  i am playing This game!”,

    source = {

        baseDir=system.ResourceDirectory, 

        filename=“abc.jpg”,

        type=“image”

    }

}

facebook.request( “me/feed”, “POST”,attachment ) 

with the help of that when i am sharing on Android any device it showing one exception.

“com.facebook.FacebookException: Session provided to a request in un-opened state”

Please give me quick response thanks.

I think you should probably post more of your code since that doesn’t look complete or in context.

But a couple of things:

  1. Make sure your Facebook hashkey is correct.

  2. If that is really how your code is, with the facebook.request coming right after the facebook.login call, it could definitely fail if the login hasn’t completed by the time the request call is made.  Your app will not stop and wait for the facebook.login to finish before continuing.

Try putting the facebook.request in your facebookListener so that it runs after the login completes and is successful, and see if it works there.

Hey Thanks,

The second option is correct. i called both at same time that was my mistake.

I changed that but some another issue came.

when i logged in successfully then it will come back to my game screen but post is not going to Facebook wall.

So in that case, again, check to see if the hashkey is correct.

Secondly, I am not sure if it is the case for all posting methods, but I don’t think Facebook allows you as the developer to set the message string anymore.  Pretty sure that is what is causing the post to fail.

Is there any more information in your console log?  Make sure to run “adb logcat” without any other parameters so you don’t filter out messages from other intents that could be causing the issue.

I think you should probably post more of your code since that doesn’t look complete or in context.

But a couple of things:

  1. Make sure your Facebook hashkey is correct.

  2. If that is really how your code is, with the facebook.request coming right after the facebook.login call, it could definitely fail if the login hasn’t completed by the time the request call is made.  Your app will not stop and wait for the facebook.login to finish before continuing.

Try putting the facebook.request in your facebookListener so that it runs after the login completes and is successful, and see if it works there.

Hey Thanks,

The second option is correct. i called both at same time that was my mistake.

I changed that but some another issue came.

when i logged in successfully then it will come back to my game screen but post is not going to Facebook wall.

So in that case, again, check to see if the hashkey is correct.

Secondly, I am not sure if it is the case for all posting methods, but I don’t think Facebook allows you as the developer to set the message string anymore.  Pretty sure that is what is causing the post to fail.

Is there any more information in your console log?  Make sure to run “adb logcat” without any other parameters so you don’t filter out messages from other intents that could be causing the issue.