gpt4 book ai didi

android - Facebook 分享按钮已禁用

转载 作者:行者123 更新时间:2023-11-30 00:56:51 24 4
gpt4 key购买 nike

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

这是 list 中的 Facebook Activity ,我没有使用提供商:

<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 按钮 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);
}
});

我在我的应用程序类中初始化 Facebook SDK,如下所示:

FacebookSdk.sdkInitialize(this);

为什么升级SDK后不可用?

最佳答案

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

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

关于android - Facebook 分享按钮已禁用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39997456/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com