简体   繁体   English

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

[英]How to check in using facebook android sdk (graph api)

I want to check in using facebook android sdk (graph api), 我想使用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 这是使用facebook graph api检查的正确方法

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

Probaly is the checkinData format. Probaly是checkinData格式。 Try: 尝试:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM