Facebook Scores api - anyone got this to work?

I’d like to use the facebook score api to have a leaderboard for my new game,
I’ve seen the example of posting a score to someone’s wall , but has anyone got an example of posting
scores to an apps facebook account?
for some reason the facebook docs make my aging brain hurt.

cheers!
[import]uid: 118333 topic_id: 31879 reply_id: 331879[/import]

I know this thread is A bit old, but the question still stands…

Did anyone got this to work?

Im searching the web for days now for tutorial to use facebook Scores API with corona but it seems like a mystery lol

Roy.

Hi Roy,

I haven’t used it myself, but the Facebook documentation at https://developers.facebook.com/docs/games/scores/ is pretty clear.  Just follow along with that documentation and use Corona’s facebook.request() API to make the calls that that page describes.  (Of course, in addition you’ll have to do the normal Facebook setup and login for a Corona app, which you can see in the Corona documentation.)

  • Andrew

Andrew,

“the Facebook documentation at https://developers.facebook.com/docs/games/scores/ is pretty clear.”

Lol is looks like Chinese (no offence to china) to me… for example :

"Create or update a score for a player

You can post a score for a player by issuing an HTTP POST request to /USER_ID/scores with a user or app access_token as long as the player has granted the publish_actions permission for your app."

 

 

I have no idea what it means to issue an HTTP POST (using corona of course) and how to make the device to request an access_token for the player cause apparently it expires every few hours, anyway, what im trying to say is that its kinda shocking how hard it is to find info on the web about ‘Facebook Scores API and Corona SDK’

Im willing to pay someone for help with this manner…

Basically, what I want for my app is, 

A user logs in to facebook, then when game over he posts his high score to Facebook, and can also see his friends’s high scores on the device… (by downloading the 'friends’s leader board to the device)

Is there anyone out there who knows how to do this?

 

Roy.

Hi Roy,

I think your challenge is that you’re searching too narrowly.  You should be looking for how to integrate Facebook in Corona in general.  Once you have that understanding, you’ll better understand the scores API (or any Facebook API, for that matter).

To start, look at these Corona guides for setting up your app on Facebook and doing the basic integration in Corona: http://docs.coronalabs.com/guide/social/setupFacebook/index.html and http://docs.coronalabs.com/guide/social/implementFacebook/index.html.

Then, to use the scores API, you would do things like facebook.request(“GET”, “me/scores”), facebook.request(“POST”, “me/scores”, {score=123}), etc.  Corona takes care of the access token for you, so all you have to do is follow the Facebook documentation to get (a) the type of request (“GET”, “POST”, etc.), the path for the request (“me/scores”), and the information you need to provide (the score).

Hope this is helpful enough to get you started.

  • Andrew

Explaining. Http request is a “http specific message” you send over internet on specific url address (www) and having special method. It is that we send request(literaly) to eg facebook server saying it to do something and it will give us some kind of responce.

Http request can be of types: GET (to get data)

www.somehost.com/player

POST(to send data)

www.somehost.com/player

and PUT, DELETE.

As you see url address under GET and POST is the same but we use different methods. Based on what url we send our request and what method we use something will be done by www.somehost,com.

Long story short.

network.request( url, method, listener [, params] )

I have no idea what it means to issue an HTTP POST (using corona of course)

it means you call 

local function myListener(event) if event.isError then print("error") else event.phase == "ended" then print(event.response) end end local myParams = { body = { score = 50 } } network.request( "www.graph.faceboom.com/facebookIdOfPerson/scores?app\_token=someTokenNumberGeneratedForYourApporUserTokenFromLoging", "POST", myListener, myParams )

Ok im gonna sit for few hours now with all the guides and explanations you gave me, and try to figure out things.

Many thanks for your patient guys.

Roy.

What aukStudios has written is doing requests through facebook api in Corona. Method with using plain network.request will give you possibility to define listener per each request (in fb api you can only have one in facebook.init)

Hey guys,

After reading over and over ive started to implant the process into the game.

I have A few questions though, and probably will have some more later on…

First thing first:

Since the simulator is not supporting facebook actions,

(im getting the error :“Facebook Connect is not supported in the simulator. Please build for device.”)

What is the best way to test it? the xcode simulator? how can I tell the xcode device is logging in to Facebook?

After calling this command: (fbAppID is declared above, and facebookListener function is there also)

[lua]        facebook.login( fbAppID, facebookListener, { “publish_stream” } )[/lua]

nothing happens on the Xcode simulator, shouldn’t a web browser pop up or something?

Second:

Like I said I want to post a score to facebook and create a ‘Leaderboard’ so what I did is this:

[lua]

        local attachment = {

            score = tostring(12345), – a simple fake score for testing

              access_token=my_access_token – grabbed from the login process

            }

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

[/lua]

Is this looks like a good format? cause like I said I see no respond (I dont know if the initial log in process even succeeded )

Roy.

I do it this way to check facebook on simulator: I just skip login part (require app being on device) and hardcode token manualy for tests. Token can be obtained through facebook’s tool for api testing linked below. There will be also token. If it expires then just push “Get Access Token” button to generate new one.

https://developers.facebook.com/tools/explorer

EDITED:

Some progress, apparently a line in the build setting was commented out.

I managed to post a score to Facebook.

More testing to do now…

Roy.

I know this thread is A bit old, but the question still stands…

Did anyone got this to work?

Im searching the web for days now for tutorial to use facebook Scores API with corona but it seems like a mystery lol

Roy.

Hi Roy,

I haven’t used it myself, but the Facebook documentation at https://developers.facebook.com/docs/games/scores/ is pretty clear.  Just follow along with that documentation and use Corona’s facebook.request() API to make the calls that that page describes.  (Of course, in addition you’ll have to do the normal Facebook setup and login for a Corona app, which you can see in the Corona documentation.)

  • Andrew

Andrew,

“the Facebook documentation at https://developers.facebook.com/docs/games/scores/ is pretty clear.”

Lol is looks like Chinese (no offence to china) to me… for example :

"Create or update a score for a player

You can post a score for a player by issuing an HTTP POST request to /USER_ID/scores with a user or app access_token as long as the player has granted the publish_actions permission for your app."

 

 

I have no idea what it means to issue an HTTP POST (using corona of course) and how to make the device to request an access_token for the player cause apparently it expires every few hours, anyway, what im trying to say is that its kinda shocking how hard it is to find info on the web about ‘Facebook Scores API and Corona SDK’

Im willing to pay someone for help with this manner…

Basically, what I want for my app is, 

A user logs in to facebook, then when game over he posts his high score to Facebook, and can also see his friends’s high scores on the device… (by downloading the 'friends’s leader board to the device)

Is there anyone out there who knows how to do this?

 

Roy.

Hi Roy,

I think your challenge is that you’re searching too narrowly.  You should be looking for how to integrate Facebook in Corona in general.  Once you have that understanding, you’ll better understand the scores API (or any Facebook API, for that matter).

To start, look at these Corona guides for setting up your app on Facebook and doing the basic integration in Corona: http://docs.coronalabs.com/guide/social/setupFacebook/index.html and http://docs.coronalabs.com/guide/social/implementFacebook/index.html.

Then, to use the scores API, you would do things like facebook.request(“GET”, “me/scores”), facebook.request(“POST”, “me/scores”, {score=123}), etc.  Corona takes care of the access token for you, so all you have to do is follow the Facebook documentation to get (a) the type of request (“GET”, “POST”, etc.), the path for the request (“me/scores”), and the information you need to provide (the score).

Hope this is helpful enough to get you started.

  • Andrew

Explaining. Http request is a “http specific message” you send over internet on specific url address (www) and having special method. It is that we send request(literaly) to eg facebook server saying it to do something and it will give us some kind of responce.

Http request can be of types: GET (to get data)

www.somehost.com/player

POST(to send data)

www.somehost.com/player

and PUT, DELETE.

As you see url address under GET and POST is the same but we use different methods. Based on what url we send our request and what method we use something will be done by www.somehost,com.

Long story short.

network.request( url, method, listener [, params] )

I have no idea what it means to issue an HTTP POST (using corona of course)

it means you call 

local function myListener(event) if event.isError then print("error") else event.phase == "ended" then print(event.response) end end local myParams = { body = { score = 50 } } network.request( "www.graph.faceboom.com/facebookIdOfPerson/scores?app\_token=someTokenNumberGeneratedForYourApporUserTokenFromLoging", "POST", myListener, myParams )

Ok im gonna sit for few hours now with all the guides and explanations you gave me, and try to figure out things.

Many thanks for your patient guys.

Roy.

What aukStudios has written is doing requests through facebook api in Corona. Method with using plain network.request will give you possibility to define listener per each request (in fb api you can only have one in facebook.init)

Hey guys,

After reading over and over ive started to implant the process into the game.

I have A few questions though, and probably will have some more later on…

First thing first:

Since the simulator is not supporting facebook actions,

(im getting the error :“Facebook Connect is not supported in the simulator. Please build for device.”)

What is the best way to test it? the xcode simulator? how can I tell the xcode device is logging in to Facebook?

After calling this command: (fbAppID is declared above, and facebookListener function is there also)

[lua]        facebook.login( fbAppID, facebookListener, { “publish_stream” } )[/lua]

nothing happens on the Xcode simulator, shouldn’t a web browser pop up or something?

Second:

Like I said I want to post a score to facebook and create a ‘Leaderboard’ so what I did is this:

[lua]

        local attachment = {

            score = tostring(12345), – a simple fake score for testing

              access_token=my_access_token – grabbed from the login process

            }

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

[/lua]

Is this looks like a good format? cause like I said I see no respond (I dont know if the initial log in process even succeeded )

Roy.

I do it this way to check facebook on simulator: I just skip login part (require app being on device) and hardcode token manualy for tests. Token can be obtained through facebook’s tool for api testing linked below. There will be also token. If it expires then just push “Get Access Token” button to generate new one.

https://developers.facebook.com/tools/explorer