Android Facebook 活动邀请

发布于 2024-11-18 08:10:33 字数 1357 浏览 4 评论 0原文

我正在开发一个 Android 应用程序,我必须使用 Rest API 邀请 Facebook 好友参加活动。

下面是我准备参数包的代码

   Bundle eventInviteParams = new Bundle();
   eventInviteParams.putString("method", "events.invite");
   eventInviteParams.putString("eid", event.getFacebookEventId());
   eventInviteParams.putString("personal_message", "Sample message");

   String userIds = "";
   for (int i = 0; i < facebookAdapter.getCount(); i++) {
    FacebookUser user = facebookAdapter.getItem(i);
    if (user.isSelected()) {
        userIds += user.getId() + ",";
    }
   }
   if (userIds.length() > 0) {
    userIds = userIds.substring(0, userIds.length() - 1); // to remove last comma
    eventInviteParams.putString("uids", userIds);
   }

,其中

response = mFacebook.request(eventInviteParams);

mFacebook 是 Facebook api 对象。

回应总是

{"error_code":200,"error_msg":"权限 错误","re​​quest_args":[{"key":"uids","value":"XXXXXXXXX,XXXXXXXXX"},{"key":"method","value":"events.invite"},{" key":"format","value":"json"},{"key":"eid","value":"XXXXXXXXXXX"},....]}

应用程序具有以下权限

"email","publish_stream","read_stream","create_event","offline_access","user_events","friends_events","rsvp_event"

我还想提一下我不是事件创建者。我在 FCB 文档和谷歌上进行了搜索,但找不到正确的答案。

I'm developing an android application where I have to invite facebook friends to an event using Rest API.

Below is the code where I prepare bundle of parameters

   Bundle eventInviteParams = new Bundle();
   eventInviteParams.putString("method", "events.invite");
   eventInviteParams.putString("eid", event.getFacebookEventId());
   eventInviteParams.putString("personal_message", "Sample message");

   String userIds = "";
   for (int i = 0; i < facebookAdapter.getCount(); i++) {
    FacebookUser user = facebookAdapter.getItem(i);
    if (user.isSelected()) {
        userIds += user.getId() + ",";
    }
   }
   if (userIds.length() > 0) {
    userIds = userIds.substring(0, userIds.length() - 1); // to remove last comma
    eventInviteParams.putString("uids", userIds);
   }

Then

response = mFacebook.request(eventInviteParams);

where mFacebook is Facebook api object.

The response is always

{"error_code":200,"error_msg":"Permissions
error","request_args":[{"key":"uids","value":"XXXXXXXXX,XXXXXXXXX"},{"key":"method","value":"events.invite"},{"key":"format","value":"json"},{"key":"eid","value":"XXXXXXXXXXX"},....]}

Application has following permissions

"email","publish_stream","read_stream","create_event","offline_access","user_events","friends_events","rsvp_event"

I want also to mention that I'm not event creator. I have searched on FCB docs and google but cannot find a proper answer.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

甜心小果奶 2024-11-25 08:10:33

非常感谢您的回复。
我继续研究,发现错误

"error_code":200,"error_msg":"Permissions error"

是因为我没有关注事件。当我回复该活动后,我得到了响应 false (我不知道为什么)并且错误消失了。我在 Facebook 上查看,指定的人被邀请了。

谢谢

Thank you very much for your response.
I continued with research and I found that the error

"error_code":200,"error_msg":"Permissions error"

was because I was not following the event. Once I RSVP to the event, I got the response false (I don't know why) and the error gone. I checked in Facebook and the given people were invited.

thanks

可爱咩 2024-11-25 08:10:33

只有创建该活动的用户才能邀请其他人参加该活动。即使用户使用“客人可以邀请朋友”创建了活动,似乎也无法通过应用程序来完成此操作。几周前我尝试了几种方法都没有效果!

Only the user that has created the event can invite people to it. Even if the user has created the event with "Guests can invite friends" it seems that it is impossible to do it from an app. A few weeks ago I tried several methods to no avail!

怎樣才叫好 2024-11-25 08:10:33

events.invite api 已损坏..在 facebook bugzilla http:// /bugs.developers.facebook.net/show_bug.cgi?id=17057

The events.invite api is broken ..check it out on the facebook bugzilla http://bugs.developers.facebook.net/show_bug.cgi?id=17057

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文