【问题标题】:Facebook Share Button disabledFacebook 分享按钮已禁用
【发布时间】:2016-10-12 11:28:52
【问题描述】:

我将 Facebook ShareButton 从 4.5.0 升级到 4.16.1,现在 ShareButton 已禁用。我必须支持回到 Android API 级别 9,我只想使用 Facebook SDK 中的 ShareButton。在 4.5 中,它运行良好。

这是清单中的 Facebook 活动,我不使用提供程序:

<activity
    android:name="com.facebook.FacebookActivity"
    android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
    android:theme="@android:style/Theme.Translucent.NoTitleBar"
    tools:replace="android:theme" />

FB Button onClick 监听器:

facebookShareButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        ShareLinkContent content = new ShareLinkContent.Builder()
            .setContentTitle(title)
            .setContentDescription(preview)
            .setContentUrl(Uri.parse(url))
            .build();
        shareDialog.show(content);
    }
});

我在我的 Application 类中初始化 Facebook SDK,如下所示:

FacebookSdk.sdkInitialize(this);

为什么升级 SDK 后就不行了?

【问题讨论】:

    标签: android facebook-share facebook-sdk-4.x


    【解决方案1】:

    在 Facebook sdk 中实现共享选项时,将您的内容设置为共享。所以在定义分享按钮的同时设置内容。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-05
      • 2012-02-09
      相关资源
      最近更新 更多