Android Facebook SDK - action.setPlace Error in Custom Stories in Andorid(Feed Dialog Method)
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,
- In developers.facebook.com, open your app dashboard.
- In the Left pane, open 'Open Graph.
- Select 'Action Types' tab
- Select the Action type for which your getting the above mentioned error.
- Scroll down to the section and you will find 'Capabilities' Section
- Turn ON 'Place' or any other capability which you would like to use
- Click Save Changes.
Now your app would work fine :)
I solve this problem by this way:
- Open your "Settings" - "Display Name"
- Change "Display Name" into your app name (must be the same)
Hope this can help you!