如何使用facebook android sdk(graph api)办理登机手续

kai*_*uki 6 android checkin facebook-graph-api

我想使用facebook android sdk(graph api)办理登机手续,

我正在尝试这个

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);
Run Code Online (Sandbox Code Playgroud)

但它给了我这个错误

{"error":{"message":"batch parameter must be a JSON array","type":"GraphBatchException"}}
Run Code Online (Sandbox Code Playgroud)

这是使用facebook graph api检查的正确方法

Ven*_*nky 13

签入的简单代码.试试这个 :

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);
Run Code Online (Sandbox Code Playgroud)

  • @Venky如何从纬度和经度获取地点ID,是否可以获得确切位置place_id或它将在附近? (2认同)