2012-01-12 24 views
6

我想在使用Facebook的Android SDK中(圖API)來檢查,如何檢查在使用Facebook的Android SDK中(圖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的圖形API

+0

查看我的更新回答 – Venky 2012-01-12 09:42:00

+0

總是歡迎..冷靜!!! – Venky 2012-01-12 11:27:37

回答

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

謝謝隊友!你節省了一天 – kaibuki 2012-01-12 10:36:01

+2

@Venky如何從經緯度獲得地點id,是否有可能獲得準確的位置place_id或它將在附近? – moDev 2013-01-03 17:44:02

1

Probaly是checkinData格式。試試:

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