1
votes

I am trying to post to a user's Facebook wall using Javascript SDK from a Phonegap mobile app. I am able to post a message to the user's wall from my app. I want to attach a location to the post so that it looks like a checkin. Facebook checkin was working fine, but since it was deprecated, I want to use Post as suggested by Facebook.

Below is my code:

    FB.api('/me/feed', 'post', {
        name: 'SomeName',
        message: 'SomeMessage',
        place: {
               'id': pageId,
               'name': name,
               'location': {
                           'latitude': latitude,
                           'longitude': longitude
                    }
               }
    },
    function (response) {
    if(response){
        alert("Post was published!");
    }
    else {
        alert("Post was not published. Try again.")
    }
    }); 

The place tag needs the id, name and location with the latitude and longitude, so I provided them as above. I get the alert message saying the Post was published!, but it isn't posted to the user's wall. If I take out the place field, it works fine.

Thanks in advance.

1

1 Answers

2
votes

Set place only for location ID. This example just worked as I searched solution for my application:

FB.api('/me/feed', 'post', {
    name: 'SomeName',
    message: 'SomeMessage',
    place: '106039436102339' // ID for Tallinn, Estonia
}, function (response) {});