I am trying to post a FB Custom story in Android using Open Graph(Share Dialog Method). The code was working very well and posted successfully, until I had added action.setPlace(). Now the Share dialog is appearing correctly. But when I click the 'POST' button, a wierd error message comes as follows
"We are Sorry, this post is no longer available. It may have been removed"
And in onActivityResult(), I get the following exception "com.facebook.FacebookException: Error publishing message"
Here is my code
OpenGraphObject place = OpenGraphObject.Factory
.createForPost("shellstationstunisia:shell_gas_station");
place.setProperty("title", "Shell Stations Tunisia");
place.setProperty(
"image",
"http://img1.wikia.nocookie.net/__cb20070306105202/uncyclopedia/images/4/4e/Shell_Logo.png");
place.setProperty(
"url",
"http://www.shell.com/global/aboutshell/contact-us/contact/contact-tunisia.html");
place.setProperty("description", "Best Gas Station in Tunisia");
OpenGraphAction action = GraphObject.Factory
.create(OpenGraphAction.class);
action.setProperty("shell_gas_station", place);
//Set a Place - THIS CAUSED THE PROBLEM - Place ID is correct
GraphPlace my_current_location = GraphObject.Factory
.create(GraphPlace.class);
my_current_location.setId("432170683497784");
action.setPlace(my_current_location);
@SuppressWarnings("deprecation")
FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(
this, action, "shellstationstunisia:travel",
"shell_gas_station").build();
uiHelper.trackPendingDialogCall(shareDialog.present());
I solved the problem by myself. It was an Authentication issue. I had to enable 'Place' Capabilites from FB Developer Panel. Just follow the steps given below,
Now your app would work fine :)