Anonymous Coder
Anonymous Coder

Reputation: 31

How to share or post game score on face book wall for android devices using Corona SDK tool?

I want to share some random score of my app on facebook. Everytime I run the app, I log in to fb successfully but the app shows the error. Here is my listener function called on facebook.login. Else statement executes instead of if ( isAvailable ) statement. I looked everything on internet but still lost.

function listener ( event )


      local serviceName = "facebook"  --supported values are "twitter", "facebook", or "sinaWeibo"

       local isAvailable = native.canShowPopup( "social", serviceName )

       if ( isAvailable ) then    --- does not execute this statement 

        local function networkListener( event )

            if ( event.isError ) then
                print( "Network error: ", event.response )
            else
                print ( "RESPONSE: " .. event.response )
            end

        end

        accessTokenFromFacebookLogin = facebook.getCurrentAccessToken();   --- gets token of current fb user
        facebookUserId = facebook.request("me", "GET", { field = "id" });                 --- gets all the data of user in this case user id



        local params = {};
        params.body = "&score="..tostring(newScore).."&access_token="..accessTokenFromFacebookLogin;
        network.request( "https://graph.facebook.com/"..facebookUserId.."/scores", "POST", networkListener, params);   --- post the score on desired user id's feed or something

    else     --- shows this msg instead  of executing if statement :(

        native.showAlert(
            "Cannot post " .. serviceName .. " score.",
            "Please setup your " .. serviceName .. " account or check your network connection.",
            { "OK" } )
    end
end

Please help me resolve this issue. Any help will be much appreciated. Thank you.

Upvotes: 1

Views: 93

Answers (1)

Bram  Vanbilsen
Bram Vanbilsen

Reputation: 6505

Facebook changed their policies a while back. You can't post pre-filled in text anymore (perhaps with added permissions but I'm not 100% sure of that). You can only post a link or an image. So perhaps you can take a screenshot of the score and upload that image? Kind regards Bram

Upvotes: 1

Related Questions