【问题标题】:how to create facebook event in an android app?如何在 android 应用程序中创建 facebook 事件?
【发布时间】:2014-07-04 11:41:56
【问题描述】:

我正在开发一个小型 android 项目来创建 facebook 事件并在其上分享照片。好吧,我在登录和注销方法方面取得了成功,但我仍然阻止创建新事件,我尝试使用旧方法:

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 中得到这个:

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}

【问题讨论】:

    标签: android facebook events


    【解决方案1】:

    https://developers.facebook.com/docs/apps/changelog

    已删除创建事件 - 应用无法再使用 API 创建事件。

    很遗憾,这已经不可能了。

    【讨论】:

    • 想你的答案,但我仍在寻找一种方法来从 android 应用程序创建 facbook 事件!你能帮我吗??
    • 这是不可能的(不再)。没有解决方法;)
    • @HoNzO,你找到方法了吗?现在有同样的问题,除了玩 Facebook 页面的 DOM 之外,我什么都没有。使用 DOM 很棘手,因为他们可以在以后轻松更改它,并且我的集成将不再起作用......所以不是最佳选择。
    • 您尝试执行的操作很可能是不允许的。没有合法的方式,就是这样。
    • 答案在您的评论中。 “官方应用”。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-04-09
    • 2012-02-04
    • 1970-01-01
    • 2011-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多