问题
I'm trying to get an Android app to post highscores to Facebook, similar to how Angry Birds on Facebook does (it get's displayed on Timeline and shows up in the Ticker too). Keep in mind that this game runs only on Android and has no FB Canvas application.
Currently the steps I take for posting the high scores are the following:
- Authenticate the user via FB when login buttons is pressed, request only publish_actions permissions - works
- Request the user id by calling "/me" via FB SDK and saving the id in a variable - works
Send a POST request via Facebook SDK when the users presses "Score 100 points", with the following code: - works (logs true from the call)
Bundle params = new Bundle(); params.putString("score", "100"); // appAccessToken is temporarily a constant facebook.setAccessToken(appAccessToken); String response = "null"; try { response = facebook.request(userId + "/scores", params, "POST"); } catch (IOException e) { e.printStackTrace(); } // Logs true if successful Log.d(TAG, response);
- Open Facebook to see updates from the game, but nothing is displayed anywhere, unlike Angry Birds which shows up on your timeline and shows the highest score - fail (no record of any high scores anywhere
Some more information you may need:
- Category of application is set to Game
- Type of application is set to Web (Native didn't allow me to properly post a new score)
- The user I'm trying with is the owner of the application
- Tried the above steps with both sandbox on and off
- If I call https://graph.facebook.com/USER_ID/scores with the appropriate access_token and user id, I get the previously sent 100 point score as a response, so the score posting seems to work
The question is why doesn't it show up anywhere in the feed/timeline/ticker. Am I missing something?
回答1:
According to the documentation and the official tutorial, you're published your scores properly. So, enter our next question: why isn't it showing up on your user's Ticker or Timeline?
The answer is, the means with which games like Angry Birds publish high scores is actually blended between the score mechanism and posting directly to a user's stream. Facebook controls the story types and distribution under which scores will be published, so your app isn't guaranteed to generate a new story item every time you post a score to the site. Quoting a primary source:
Facebook says the stories that get the most clicks, likes, and comments will get more distribution in News Feed and on Timeline.
Fortunately, you have a recourse if the user allows it. If you believe your user cares very much about having their high scores published, you can ask for permission to post to their stream directly and do so with your own custom messages. More information can be found here.
(Additional reference)
来源:https://stackoverflow.com/questions/9817421/facebook-score-api-calls-from-android-not-displaying-high-scores-on-timeline-tic