简体   繁体   English

Android使用Facebook Sdk 3.1邀请朋友到App(打开游戏商店链接)

[英]Android Invite friends to App (open play store link) using Facebook Sdk 3.1

I am trying to send invitation to facebook friends using Facebook sdk 3.1. 我正在尝试使用Facebook sdk 3.1向facebook朋友发送邀请。 Here is code: 这是代码:

Bundle params = new Bundle();
params.putString("message", "Come join me in the GuessWhat!");
params.putString("to", TextUtils.join(",", invitableTokens));

WebDialog dialog = new WebDialog.Builder(context, Session.getActiveSession(), action, params).setOnCompleteListener(
            new WebDialog.OnCompleteListener() {

                @Override
                public void onComplete(Bundle values, FacebookException error) {

                    if(error!=null)
                        Log.i(getClass().getSimpleName(), "Invitation Error :" + error.getMessage());
                    else
                        Utils.showToast_msg(context, getString(R.string.invite_sent));

                }
            }).build();

    // Hide the notification bar and resize to full screen
    Window dialog_window = dialog.getWindow();
    dialog_window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    // Show the dialog
    dialog.show();

Using webdialog it opens up a dialog to add friends to send invites. 使用webdialog打开一个对话框,添加朋友发送邀请。 Invitation is sent successfully. 邀请已成功发送。 But it does not received by receiver. 但接收器没有收到它。 If i add a paltform "Facebook canvas" then it sends invitation and friend receives the invitation but on clicking the invite it redirects to Facebook canvas (nothing is there to show). 如果我添加一个paltform“Facebook画布”然后它发送邀请和朋友收到邀请,但点击邀请它重定向到Facebook画布(没有什么是显示)。 I simply want to send app invites to facebook friends (without Facebook canvas) and when click on invite it should redirect to Google play store to open the app. 我只是想向Facebook好友发送应用邀请(没有Facebook画布),点击邀请时,它应该重定向到Google Play商店以打开应用。 Any suggestions? 有什么建议么?

Better to shift to 4.0 FB Api version because. 最好转移到4.0 FB Api版本,因为。 To send app invites you must use version 4.0 or later of the Facebook Android SDK. 要发送应用邀请,您必须使用Facebook Android SDK 4.0或更高版本。 Read more about getting started with the Facebook SDK for Android to properly setup for you environment. 详细了解如何开始使用适用于Android的Facebook SDK,以便为您的环境进行正确设置。

for more details check Facebook Developer Portal. 有关详细信息,请查看Facebook Developer Portal。

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

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