Android Facebook 活动邀请
我正在开发一个 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":"权限 错误","request_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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
非常感谢您的回复。
我继续研究,发现错误
是因为我没有关注事件。当我回复该活动后,我得到了响应
false
(我不知道为什么)并且错误消失了。我在 Facebook 上查看,指定的人被邀请了。谢谢
Thank you very much for your response.
I continued with research and I found that the 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
只有创建该活动的用户才能邀请其他人参加该活动。即使用户使用“客人可以邀请朋友”创建了活动,似乎也无法通过应用程序来完成此操作。几周前我尝试了几种方法都没有效果!
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!
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