使用Facebook旧api在Android中创建事件
我有这个密码使用Facebook旧api在Android中创建事件,android,facebook,events,facebook-graph-api,Android,Facebook,Events,Facebook Graph Api,我有这个密码 JSONObject event = new JSONObject(); Bundle bundle = new Bundle(); bundle.putString("method","events.create"); event.put("name", "name"); event.put("location", "Address"); event.put("start_time",
JSONObject event = new JSONObject();
Bundle bundle = new Bundle();
bundle.putString("method","events.create");
event.put("name", "name");
event.put("location", "Address");
event.put("start_time", "2011-12-15T10:13:00");
event.put("end_time", "2011-12-15T10:20:00");
event.put("privacy_type", "OPEN");
event.put("event_info", "INFO");
Log.d(TAG,"evento "+mFacebook.request(bundle));
这个错误
{"error_code":100,"error_msg":"The parameter event_info is required","request_args": [{"key":"access_token","value":"asdasdasd"},{"key":"method","value":"events.create"},{"key":"format","value":"json"}]}
我正在使用旧的api…如果您知道使用新api在Android中创建事件,我将不胜感激
提前感谢您可以使用:send POST request创建。我尝试使用以下参数:名称、开始时间、结束时间、描述、隐私类型。
如果我正确理解了重新查询的参数,那么只需要名称和开始时间。如果未设置结束时间,则等于开始时间+3h。默认情况下,隐私是开放的。
但我不明白,你想从活动信息中得到什么?
您可以添加到POST字段位置。或者您希望将facebook对象作为某个位置发送扩展信息(如在Graph API中)?语法有问题。事件信息标记接受jsonObject而不是字符串。必须将Json对象作为事件信息的参数传递。这是我的工作代码。试试这个
JSONObject json = null;
try {
json = new JSONObject();
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 = new Bundle();
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();
}
这对我来说很好。我希望它能对你起作用。嗨,贝诺菲。。我还试图从我的应用程序中添加事件。我不知道。你能发一些代码吗。。谢谢你好,金刚狼!我的问题下面有一个正确的答案。尝试在你的应用程序中这样做。我在发布事件时也会遇到同样的错误。你能把货到付款的样品寄给我吗