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());

Answers


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,

  1. In developers.facebook.com, open your app dashboard.
  2. In the Left pane, open 'Open Graph.
  3. Select 'Action Types' tab
  4. Select the Action type for which your getting the above mentioned error.
  5. Scroll down to the section and you will find 'Capabilities' Section
  6. Turn ON 'Place' or any other capability which you would like to use
  7. Click Save Changes.

Now your app would work fine :)


I solve this problem by this way:

  1. Open your "Settings" - "Display Name"
  2. Change "Display Name" into your app name (must be the same)

Hope this can help you!


Need Your Help

Using group_by_hour_of_day: rails using groupdate gem

ruby-on-rails date

I wanted to group the total checkin in a day using the groupdate gem with this code.

Is object facing another

javascript 3d three.js

I'd like to derive a value for how much one object is facing another. For example if it is directly facing the value would be 1 and facing directly away -1.