I am using the following code to chekin in Facebook using android :
private void checkin(){
String access_token = mPrefs.getString("access_token", null);
Bundle params = new Bundle();
params.putString("access_token", access_token);
JSONObject place = new JSONObject();
try {
place.put("location", location.toString());
place.put("name", name);
place.put("id", id);
} catch (JSONException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Log.i("place", place.toString());
params.putString("place", place.toString()); // YOUR PLACE ID
params.putString("message","I m here in this place");
JSONObject coordinates = new JSONObject();
try {
coordinates.put("latitude", Latitude);
coordinates.put("longitude", Longitude);
} catch (JSONException e) {
e.printStackTrace();
}
params.putString("coordinates",coordinates.toString());
params.putString("tags", "xxxx");//where xx indicates the User Id
String response="";
try {
response = facebook.request("me/checkins", params, "POST");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Log.d("Response",response);
}
but during checkin i am getting an error as ::
{"error":{"message":"(#114) An id must be a valid ID string (e.g., \"123\")","type":"OAuthException","code":114}}
This is how i get place details where page url is my FB page URL:
try {
String response = facebook.request(pageURL);
Log.i("Facebook Page Response ", response);
JSONObject jobj = new JSONObject(response);
location = new JSONObject(jobj.getString("location"));
Latitude = location.getString("latitude");
Longitude = location.getString("longitude");
id = jobj.getString("id");
name = jobj.getString("name");
Log.i("Latitude", location.getString("latitude"));
Log.i("Longitude", location.getString("longitude"));
Log.i("id", jobj.getString("id"));
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
Please help me out i am very new to using the Facebook api.
Sorry I should not have used this method. It is deprecated according to Facebook docs.