gpt4 book ai didi

android - 如何使用 facebook android sdk (graph api) 签到

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:31:17 26 4
gpt4 key购买 nike

我想使用 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);

但它给我这个错误

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

这是使用 facebook graph api 签到的正确方法吗

最佳答案

checkin 的简单代码。试试这个:

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

关于android - 如何使用 facebook android sdk (graph api) 签到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8832482/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com