Create Events In Android Using Facebook Old Api
I have this code JSONObject event = new JSONObject(); Bundle bundle = new Bundle(); bundle.putString('method','events.create'); event.put('name', 'n
Solution 1:
You can create event using Graph API: send POST request. I try with parameters: name, start_time, end_time, description, privacy_type. If I right understood requered params only name and start_time. If you not set end_time, it will be equal start_time + 3h. By default privacy is OPEN. But I not understood, what you want from event_info? You can add to POST field location. Or you want send extend information with facebook object as some place (as in Graph API venue)?
Solution 2:
Problem with your syntax. event_info tag take jsonObject not string. You have to pass Json object as parameter for event_info. This is my working code . Try this.
JSONObject json = null;
try {
json = newJSONObject();
json.put("privacy_type", "OPEN");
json.put("name", mEventName.toString());
json.put("start_time",mCurrentDateTime);
json.put("end_time", mExpiryDateTime);
json.put("description",mEventName.toString());
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Bundle params = newBundle();
params.putString("method", "events.create");
params.putString("event_info", json.toString());
String response = "";
try {
response = facebook.request(params);
Log.d("gaurav", "response of create events ="+response);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
This is working fine for me.I hope it will work for you.
Post a Comment for "Create Events In Android Using Facebook Old Api"