The docs are terrible. I want to publish a users check in to facebook. According to the docs creating a checkin object is deprecated
https://developers.facebook.com/docs/reference/api/checkin
and instead you're supposed to add a post with location data attached. So that's what I'm trying to do. Or maybe i'm supposed to try to publish and open graph story?
Anyways here's what I have, it's basically the code to publish a post that is in their SDK sample, the post is created but there is no location data attached.
private void publishStory() {
Session session = Session.getActiveSession();
if (session != null) {
Bundle placeBundle = new Bundle();
Bundle locationBundle = new Bundle();
Bundle postParams = new Bundle();
locationBundle.putString("latitude",String.valueOf(place.getLat()));
locationBundle.putString("longitude",String.valueOf(place.getLng()));
placeBundle.putString("id", place.getPage_id());
placeBundle.putString("name", place.getName());
placeBundle.putBundle("location", locationBundle);
postParams.putBundle("place", placeBundle);
postParams.putString("message", "test message");
Request.Callback callback = new Request.Callback() {
public void onCompleted(Response response) {
String postId = null;
try {
JSONObject graphResponse = response.getGraphObject().getInnerJSONObject();
postId = graphResponse.getString("id");
}
catch (JSONException e) {
Log.i(app.TAG, "JSON error " + e.getMessage());
}
catch(Exception e){
e.printStackTrace();
}
FacebookRequestError error = response.getError();
if (error != null) {
Toast.makeText(mContext, error.getErrorMessage(), Toast.LENGTH_SHORT).show();
}
else {
Toast.makeText(mContext, postId, Toast.LENGTH_LONG).show();
}
}
};
Request request = new Request(session, "me/feed", postParams, HttpMethod.POST, callback);
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
}
else {
toast("no session to publish");
}
}
the session does have publish permissions and it WILL publish a post but all that is there is the "test message" string. The place object is from facebook's servers so it is an actual place with a page_id. When i'm debugging the post params look something like this
Bundle[{message=test message, place=Bundle[{id=171229079554355, location=Bundle[{longitude=-122.434568, latitude=37.797314}], name=The Brixton San Francisco}]}]