Facebook SDK 4.0 AppInviteDialog with callback

后端 未结 1 1735
别跟我提以往
别跟我提以往 2020-12-16 01:00

In the new Fb SDK 4.0 for Android you can register a callback for the LoginButton according to the docs. https://developers.facebook.com/docs/facebook-login/android/v2.3

相关标签:
1条回答
  • 2020-12-16 01:31

    Yes, this is possible.

    public static void openDialogInvite(final Activity activity)
    {
        String appLinkUrl, previewImageUrl;
    
        appLinkUrl = "your app link url";
        previewImageUrl = "https://www.example.com/my_invite_image.jpg";
    
        if (AppInviteDialog.canShow())
        {
            AppInviteContent content = new AppInviteContent.Builder()
                    .setApplinkUrl(appLinkUrl)
                    .setPreviewImageUrl(previewImageUrl)
                    .build();
    
            AppInviteDialog appInviteDialog = new AppInviteDialog(activity);
            CallbackManager sCallbackManager = CallbackManager.Factory.create();
            appInviteDialog.registerCallback(sCallbackManager, new FacebookCallback<AppInviteDialog.Result>()
            {
                @Override
                public void onSuccess(AppInviteDialog.Result result)
                {
                }
    
                @Override
                public void onCancel()
                {
                }
    
                @Override
                public void onError(FacebookException e)
                {
                }
            });
    
            appInviteDialog.show(content);
        }
    }
    
    0 讨论(0)
提交回复
热议问题