简体   繁体   English

Android Facebook将应用程序请求发送给朋友

[英]Android facebook send app request to friend

I am able to fetch the facebook friends list.Now I am trying to send app request to one of my selected facebook friend.I am getting success dialog at my end but it's not reflecting on my friends account. 我能够获取Facebook朋友列表。现在我正尝试向我选择的Facebook朋友之一发送应用程序请求。我在最后获得了成功对话框,但它并没有反映在我的朋友帐户上。

Here is my code to send app request: 这是我发送应用程序请求的代码:

//SEND FRIEND REQUEST TO FRIEND
    public static void sendFriendRequest(String friendId){
        Facebook facebook = new Facebook(APP_ID);
        Bundle params = new Bundle();
        params.putString("message", "invite friends");
        params.putString("title", "Send a Request");
        params.putString("message", "Test Task");
        params.putString("to", friendId); 
        facebook.dialog(_activity, "apprequests", params, new DialogListener() {
            @Override
            public void onComplete(Bundle values) {
                Constant.showAlertDialog("", "Friend request sent.", _activity.getParent(), false);
            }

            @Override
            public void onFacebookError(FacebookError error) {}

            @Override
            public void onError(DialogError e) {}

            @Override
            public void onCancel() {}
        });

    }

Please suggest the solution how can I send app request to my facebook friend sucessfully. 请提出解决方案,如何将应用请求成功发送给我的Facebook朋友。

Your code is absolutely fine.What I assume is, you have not set the required fields in the Facebook app console.see the Following image.Those are the required fields in order to send app request. 您的代码绝对正确。我想是,您尚未在Facebook应用程序控制台中设置必填字段。请参见下图。这些是发送应用程序请求的必填字段。 在此处输入图片说明

Package Name: Insert the package name of your app so that user will be redirected to your app in the Google Play if the app is loaded in the market. 套件名称:插入您应用的套件名称,以便在市场上加载该应用时将用户重定向到您在Google Play的应用。

Class Name: It is the launcher Activity name of your App. 类名称:它是您应用程序的启动器活动名称。

Key Hashes: It is the unique identifier SHA1 key that you have to generate. 密钥哈希值:这是您必须生成的唯一标识符SHA1密钥。

Facebook Login, Deep Linking: both need to be enabled. Facebook登录,深层链接:都需要启用。

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

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