android - 我们可以更改 facebook 上链接的图像(由 android 应用程序发布)吗

标签 android facebook facebook-android-sdk

我们可以更改 facebook 上链接的图像(由 android 应用程序发布)

我正在通过我的应用程序在 FaceBook 上发布一些链接,但我希望其他图像显示在 Facebook 墙上

我的代码是这样的

Intent shareCaptionIntent = new Intent(Intent.ACTION_SEND);
shareCaptionIntent.setType("image/png");
shareCaptionIntent.putExtra(Intent.EXTRA_STREAM, "<URL>");
//set caption
shareCaptionIntent.putExtra(Intent.EXTRA_TEXT, "example caption");
shareCaptionIntent.putExtra(Intent.EXTRA_SUBJECT, "example caption");
startActivity(Intent.createChooser(shareCaptionIntent,getString(R.string.share)));

我也可以看到标题和描述。 如何更改图像并使描述和标题可见,请查找附件图像 enter image description here

最佳答案

如果您只是进行分享,您分享的链接会被 Facebook 检测(解析)并获取您分享的目标 url 上定义的元标记。

具体到你的问题:

<meta property="og:title" content="The Rock" />
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" />
<meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg" />
<meta property="og:description" content="A great movie with Sean Connery and Nicolas Cage" />

如果您有权更改这些元标记,那么您就可以控制在 Facebook 上显示的帖子的图像、标题和描述。

有关引用,请参阅 http://ogp.me/以及使用 Facebook 调试器 http://developers.facebook.com/tools/debug对您共享的网址进行 lint(解析)。

关于android - 我们可以更改 facebook 上链接的图像(由 android 应用程序发布)吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17613196/

相关文章:

Android XML 绘图缩放

android - Jetpack Compose - 在自定义布局中获取点击位置

html - 如何让弹窗覆盖文章

facebook - 发布带有不带 'shared as link' 的链接的提要

Android FB API 3.0 - 应用程序针对 Facebook 的配置错误

android - 如何在 facebook android.. 中获得对接受的应用程序请求的响应?

Android:当项目太多时,ListView 隐藏下面的布局

android - CWAC-Camera getVideoFilename 返回无效的文件名

python - AppEngine Python 上的 Facebook "Login"(OAuth2)

android - Facebook Android SDK - 应用程序请求不会重定向到 Google Play 商店