Question

I want to check in using facebook android sdk (graph api),

I am trying this

String checkinData = "{"+
                        "\"message\"=\"Test\"" +
                        "\"place\"=\"000000000\"" 
                        +   "\"coordinates\"={\"latitude\":\"000000000\", \"longitude\":\"-000000000\"}\"" + "}";

                Bundle params  = new Bundle();
                params.putString("checkin", checkinData);
                String pageData = "";

                try {
                    pageData = facebook.request("/checkins", params, "POST");
                } catch (Exception e) {

                    e.printStackTrace();
                }

                System.out.println("Data :  " + pageData);

But its giving me this error

{"error":{"message":"batch parameter must be a JSON array","type":"GraphBatchException"}}

is this correct way to check in using facebook graph api

Was it helpful?

Solution

Simple code for checkins . Try this :

Bundle params = new Bundle();
params.putString("access_token", "YOUR ACCESS TOKEN");
params.putString("place", "203682879660695");  // YOUR PLACE ID
params.putString("message","I m here in this place");
JSONObject coordinates = new JSONObject();
coordinates.put("latitude", "YOUR LATITUDE");
coordinates.put("longitude", "YOUR LONGITUDE");
params.putString("coordinates",coordinates.toString());
params.putString("tags", "xxxx");//where xx indicates the User Id
String response = faceBook.request("me/checkins", params, "POST");
Log.d("Response",response);

OTHER TIPS

Probaly is the checkinData format. Try:

String checkinData = "{"+
                    "\"message\":\"Test\"," +
                    "\"place\":\"000000000\"," 
                    +   "\"coordinates\":{\"latitude\":\"000000000\", \"longitude\":\"-000000000\"}\"" + "}";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top