我有用于在Facebook上共享应用程序的这段代码,但是当我共享它时,它将放置正确的链接,但显示的应用程序图片错误
Button bShare = (Button) findViewById(R.id.button7);
bShare.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
final Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "https://play.google.com/store/apps/details?id=com.myglobaljournal.christmascarol");
startActivity(Intent.createChooser(intent, "Share with"));
最佳答案
您可以使用Debug tool来检查Facebook如何“看到”此URL。
从结果中可以看到,没有定义og元标记,因此facebook可能会从内容中随机抽取图片。
编辑
Facebook使用开放图元标签提取信息,然后将其用于在Facebook体验上呈现共享故事。
您可以在archived version of the Open Graph protocol中看到一个示例,新版本在其中使用了标记,但是它太复杂了,无法满足您的需求。
唯一的问题是:您可以控制自己应用的Google Play商店的输出吗?
我的猜测是您不能这样做,并且如果您查看其他示例(例如instagram或opera mobile),图像也会显得随机。