发送私人讯息给我的朋友使用我的Android应用程序 [英] Send private message to my friend(s) using my android application
问题描述
我正在开发一个应用程序,用户可以在其中与他/她的Facebook朋友分享消息。我正在使用Facebook API的Android。我能够验证用户,以及我可以将我的朋友列表作为Facebook用户,并在墙上发布消息,但我正在寻找发送私人消息给我的朋友,我没有得到任何解决方案,所以可以任何身体帮助我,如何实现...
I am developing an application in which user can share messages with his/her Facebook friends. I am using Facebook API for android. I can able to authenticate user, as well as I can get my friend list as a Facebook user and also post message on wall, but I am looking for sending private message to my friends and I didn't get any solution for that, so can any body help me, how can I achieve ...
提前感谢
p>
推荐答案
使用图形API可以代表用户发送私人消息。
It is not possible to send private messages on the behalf of the user using the graph api.
然而,您应该可以使用发送对话,尽管我避风港不要在android上尝试,但应该是这样的:
You should however be able to use the Send Dialog, though I haven't tried it on android, but it should be something like:
Bundle params = new Bundle();
params.putString("to", "USER_ID");
params.putString("name", "TITLE HERE");
params.putString("link", "A URL"); // this link param is required
facebook.dialog(context, "send", params, new DialogListener() {
@Override
public void onComplete(Bundle values) {
....
}
@Override
public void onFacebookError(FacebookError error) {}
@Override
public void onError(DialogError e) {}
@Override
public void onCancel() {}
});
您可以使用的另一种方法是聊天API ,您可以代表用户发送邮件,它需要 xmpp_login
权限,您可以实现一个xmpp
Another approach you can use is the Chat API with which you can send messages on the behalf of the user, it requires the xmpp_login
permission and you to implement an xmpp client.
由于不支持此对话框而在android中,您有3个选项:
Since this dialog is not supported yet in android, you have 3 options:
- 等待Facebook实现android的对话框。
- 尝试在移动设备中的浏览器(文档中的URL)中打开该对话框。
- 要求
xmpp_login
并添加一个xmpp客户端(即: asmack ),并且您可以实现自己的发送消息对话框。
- Wait for facebook to implement the dialog for android.
- Try to open the dialog in a browser (the url for that is in the docs) in the mobile device.
- Ask for the
xmpp_login
and add a xmpp client (i.e.: asmack) and with that you can implement your own "Send Message" dialog.
这篇关于发送私人讯息给我的朋友使用我的Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!