简体   繁体   English

Android Facebook API未发送APP请求

[英]Android Facebook API not sending APP Requests

I am using the Android Hackbook app. 我正在使用Android Hackbook应用。 I have slightly modified the code to send a app request to aa Custom Friend. 我对代码进行了少许修改,以将应用程序请求发送给“自定义朋友”。 Here is the code. 这是代码。

Bundle params = new Bundle();
    params.putString("title", "invite friends");
    params.putString("message", getString(R.string.request_message));
    params.putString("to", userId);
    Utility.mFacebook.dialog(Hackbook.this, "apprequests", params, new AppRequestsListener());

This brings up a dialog to send a app request to the friend who user id i selected. 这将弹出一个对话框,向我选择了用户ID的朋友发送应用程序请求。 The AppRequestsListener code gets executed and it shows me a toast that the request was successful. AppRequestsListener代码被执行,并向我敬酒请求已成功完成。 How the user never receives the request. 用户如何永远不会收到请求。 What am i doing wrong. 我究竟做错了什么。 Is there some permission that i need to grant to the application first. 我首先需要向应用程序授予一些许可吗? Really stuck, any help would be good 真的卡住了,任何帮助都很好

Kind Regards, 亲切的问候,

Try this: 尝试这个:

        Facebook facebook = new Facebook(YOUR_APP_ID);
        Bundle params = new Bundle();
        params.putString("to", userId);
        params.putString("message", "getString(R.string.request_message)");
        facebook.dialog(((Activity) ctx).getParent(), "apprequests",
                params, new DialogListener() {

                    public void onComplete(Bundle values) {
                        // TODO Auto-generated method stub
                        Toast.makeText(ctx, "<<Complete>>",
                                Toast.LENGTH_SHORT).show();
                    }

                    public void onFacebookError(FacebookError e) {
                        // TODO Auto-generated method stub
                    }

                    public void onError(DialogError e) {
                        // TODO Auto-generated method stub
                    }

                    public void onCancel() {
                        // TODO Auto-generated method stub
                    }

        });

This works for me. 这对我有用。 User receive request as expected. 用户收到预期的请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM