I am working on an android game using PHP, however when I try to post to the score to my Facebook wall the description is merged with another application.
Description taken from this App Daily Tools and my actual game is Just Double It
Image is below, logo & description is wrong
Description: My game description + my app description.
The description was automatically detected and not written by me.
Here is my code snippit for posting to Facebook
var APP_ID="*****************";
window.fbAsyncInit = initFacebook;
function initFacebook()
{
FB.init({
appId : APP_ID,
status : true, // check login status
cookie : false, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.getLoginStatus(onFacebookLoginStatus);
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
//the login function
function facebookLogin()
{
var loginUrl="http://www.facebook.com/dialog/oauth/?"+
"scope=publish_stream&"+
"client_id="+APP_ID+"&"+
"redirect_uri="+document.location.href+"&"+
"response_type=token";
window.location=loginUrl;
}
function postToWallUsingFBApi()
{
var score=atob(document.getElementById("txtscore").value);
var data=
{
caption: "scores "+score,
message: "I challenge you to beat my score "+score + " in Just Double It! on your Android Phone !!!",
picture: "http://www.learning-delight.com/ldapps/Game/main.png",
link: 'https://play.google.com/store/apps/details?id=com.appslight.justdoubleit',
}
FB.api('/me/feed', 'post', data, onPostToWallCompleted);
}
//the return function after posting to wall
function onPostToWallCompleted(response)
{
(response)
{
if (response.error)
{
document.getElementById("txtEcho").innerHTML=response.error.message;
}
else
{
if (response.id){
window.close();
t = setTimeout("self.close()",500);
}
else if (response.post_id)
document.getElementById("txtEcho").innerHTML="Posted as post_id responce "+response.post_id;
else
document.getElementById("txtEcho").innerHTML="Unknown Error";
}
}
}
@DrewT's answer covers the problem and some workaround to solve it. Another way to go is to have full control over the content you post and dont let facebook scrape it. If you look at the post params you can send to facebook, you'll notice there is also a description
param.
var data=
{
caption: "scores "+score,
description: "I HAVE THE POWER!!",
message: "I challenge you to beat my score "+score + " in Just Double It! on your Android Phone !!!",
picture: "http://www.learning-delight.com/ldapps/Game/main.png",
link: 'https://play.google.com/store/apps/details?id=com.appslight.justdoubleit',
}
Yikes! Facebook is scraping the wrong open graph data. You're getting data from another app because they are probably hosted on the same server and Facebook didn't find enough Open Graph data for Just Double It but it DID find description and picture data on the server (i.e. from Daily Tools). If it's the only Open Graph data on that server, I don't think it's going to matter even if the two projects are being hosted in different folders.
It seems like you've done all the work creating the App and validating it properly with oAuth2 so here's what's left to check:
Say you already have all the Open Graph data you need and you've verified it's location:
Once it's been processed in the debugger your Just Double It Open Graph data will be active immediately for future wall posting requests your app pushes.
Lastly, here are examples of the two Open Graph tags your app seems to have missed:
<meta property="og:image" content="../relative_path_to_your_image"/>
<meta property="og:description" content="Desired description of your app"/>
Hope that helps, good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With