如何在Android应用程序创建Facebook的事件? [英] how to create facebook event in an android app?
问题描述
我米工作的一个小机器人项目创建Facebook的事件,就可以分享照片。嗯,我succeded在登录和注销方法,但即时通讯仍然堵在创建新的事件,我尝试使用老方法:
I m working on an small android project to create facebook events and sharing photos on it . Well I'm succeded in login and logout methods but i m still blocking in the creation of new event, I tried the old method using the:
Bundle params = new Bundle();
params.putString("privacy_type", "OPEN");
params.putString("name", "This is a test event");
params.putString("start_time", "2013-12-02T18:00:00+0530");
params.putString("end_time", "2013-12-02T20:00:00+0530");
params.putString("description", "This is test description yeah?.");
params.putString("location", "Mount Lavinia");
params.putString("privacy_type", "OPEN");
String response = "";
Facebook facebook = new Facebook(APP_ID);
AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
mAsyncRunner.request("me/events", params, "POST",
new RequestListener() {
public void onComplete(String response, Object state) {
try {
Log.i(TAG, "start");
JSONObject event = new JSONObject(response);
Log.i(TAG, response);
String event_id = event.getString("id");
Log.i(TAG, "end");
Log.i(TAG, "Event id => " + event_id);
// Toast.makeText(getApplicationContext(),
// "New Event Created!!",
// Toast.LENGTH_LONG).show();
} catch (Exception e) {
}
}
}, null);
和新的方法:
Session session = Session.getActiveSession();
Bundle params = new Bundle();
params.putString("privacy_type", "OPEN");
params.putString("name", "This is a test event");
params.putString("start_time", "2013-12-02T18:00:00+0530");
params.putString("end_time", "2013-12-02T20:00:00+0530");
params.putString("description", "This is test description yeah?.");
params.putString("location", "Mount Lavinia");
new Request(
session,
"me/events",
params,
HttpMethod.POST,
new Request.Callback() {
public void onCompleted(Response response) {
/* handle the result */
try {
Log.i(TAG, response.toString());
// Toast.makeText(getApplicationContext(),
// "New Event Created!!",
// Toast.LENGTH_LONG).show();
} catch (Exception e) {
Log.i(TAG, "noresponse");
}
}
}
).executeAsync();
但我总是得到这个在LogCat中:
but Im always getting this in the LogCat :
5月7日至四日:50:48.749:I / MainActivity(3159):{响应:响应code:200,graphObject:空,错误:{的HTTPStatus:-1,错误code:-1 ,ERRORTYPE:空,的errorMessage:显示java.lang.NullPointerException},isFromCache:假}
07-04 05:50:48.749: I/MainActivity(3159): {Response: responseCode: 200, graphObject: null, error: {HttpStatus: -1, errorCode: -1, errorType: null, errorMessage: java.lang.NullPointerException}, isFromCache:false}
推荐答案
https://开头的开发。 facebook.com/docs/apps/changelog
创建活动删除 - 应用程序无法再创建与API事件
Create event Removed - Apps can no longer create events with the API.
这是不再可能,很遗憾。
This is no longer possible, unfortunately.
这篇关于如何在Android应用程序创建Facebook的事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!