Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using LibGDX to create an Android game. I am not making the HTML backend of the game. I just want it to be on the Android Google Play store.

Is it possible to post the scores to Facebook? And if so, how can I do it? I searched and found the solutions only for web-based games.

share|improve this question
To post scores to Facebook, you'll need a network connection. Why not writing a small server side program that processes the data? It seems to me that languages such as PHP are binded by Facebook APIs. Also, if you didn't know it, you can easily pass variables through the URL request of a PHP script. – guillaume Jul 23 '13 at 8:55

The Facebook APIs are HTTP-based, so you can issue a HTTP post request from your game to the appropriate API endpoint (see "Publish a Post," which unfortunately has no anchor). The endpoint in question is me/feed, so you'll want to construct a request that looks basically like this:"SCORES HERE"&access_token=X

(You'll have to make sure to follow the steps for authentication detailed in the documentation to get the access token you should pass instead of X).

You should be able to use HttpUrlConnection approximately as follows (untested, sortof-pseudocode):

url = new URL("");
connection = (HttpURLConnection) url.openConnection();

// Indicates POST.

// Encode parameters.
StringBuffer parameters = new StringBuffer();
parameters.append(URLEncoder.encode("message", "UTF-8"));
parameters.append(URLEncoder.encode("\"Score Data Here\"", "UTF-8"));
parameters.append(URLEncoder.encode("access_token, "UTF-8"));
parameters.append(URLEncoder.encode("Access Token Here", "UTF-8"));

// Transmit data.
writer = new OutputStreamWriter(connection.getOutputStream());
share|improve this answer

Create and host a PHP web service application that, when accessed, takes the scores as HTTP GET argument, performs any needed verification, and then posts them to Facebook using the Facebook API.

PHP is very easy and simple. It will get you up and running in minutes. Use a [WAMP] ( server if you are using Windows.

You may need to creat a Facebook application from the Apps link in Facebook.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.