【问题标题】:Facebook Dialog in android Not coming upandroid中的Facebook对话框没有出现
【发布时间】:2015-03-31 12:02:04
【问题描述】:

我正在使用 Facebook SDK for android 开发 android 应用程序。

我想使用 Facebook 分享对话框:

ShareLinkContent content = new ShareLinkContent.Builder()
                .setContentUrl(Uri.parse("https://developers.facebook.com"))
                .build();

当我运行应用程序时,没有任何反应,没有对话框出现 - 没有错误。

有人可以帮忙吗?

【问题讨论】:

    标签: android facebook android-layout android-activity


    【解决方案1】:

    先初始化

    FacebookSdk.sdkInitialize(getApplicationContext());
    callbackManager = CallbackManager.Factory.create();
    shareDialog = new ShareDialog(this);
    

    比显示

    if (ShareDialog.canShow(ShareLinkContent.class)) {
    ShareLinkContent linkContent = new ShareLinkContent.Builder()
            .setContentTitle("Hello Facebook")
            .setContentDescription(
                    "The 'Hello Facebook' sample  showcases simple Facebook integration")
            .setContentUrl(Uri.parse("http://developers.facebook.com/android"))
            .build();
    
    shareDialog.show(linkContent);
    }
    

    最后调用这个。

    @Override
    protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        callbackManager.onActivityResult(requestCode, resultCode, data);
    }
    

    【讨论】:

    • 如何在没有任何“内容 URL”的情况下只发布标题、描述和图片?
    猜你喜欢
    • 1970-01-01
    • 2018-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多