Android-Facebook共享内容被覆盖
这是我在Facebook上分享高分的代码:Android-Facebook共享内容被覆盖,android,facebook,Android,Facebook,这是我在Facebook上分享高分的代码: ShareLinkContent content = new ShareLinkContent.Builder() .setImageUrl(Uri.parse("http://www.example.com/myicon.png")) .setContentTitle("I scored "+numPoints+" points!") .setContentUrl(Uri.parse("https://play.google.com/st
ShareLinkContent content = new ShareLinkContent.Builder()
.setImageUrl(Uri.parse("http://www.example.com/myicon.png"))
.setContentTitle("I scored "+numPoints+" points!")
.setContentUrl(Uri.parse("https://play.google.com/store/apps/details?id=com.my.package"))
.setContentDescription("Get the game free on Google Play and beat my score.")
.build();
ShareDialog shareDialog = new ShareDialog(this);
shareDialog.show(content);
当URL是某个随机站点(如developers.facebook.com)时,这非常有效,但当它是指向Google Play的链接时,内容标题和内容描述会被覆盖-标题会被Play store中的标题覆盖,内容描述为空
那么,如何链接到Play store上的应用程序,但保留自定义标题和描述?我知道这是可能的,因为我见过其他应用程序这样做:
重复的帖子,其中有一个链接,Facebook确认了这一行为,并声明他们可能不会修复它
至于其他应用程序是如何获得这种行为的,我有一个猜测
如果您的应用程序有一个可以添加虚拟页面的网站,那么您可以执行以下操作:
<html>
<head>
<script type="text/javascript">
window.location.replace('https://play.google.com/store/apps/details?id=com.example.client');
</script>
</head>
<body></body>
</html>
演示如何处理应用程序中的链接
<activity
android:name="com.example.client.MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<data android:scheme="example"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
如果你想要的话。上面的示例HTML来自它们的一个托管页面(注意重定向的不同实现)。您可以使用deeplinking方法来实现这一点。
你所要做的就是创建一个html页面,将所有商店链接(Google Play、App store)放在一个元标记中,并尝试共享该链接。你将能够实现你想要的,而且如果用户在Android上打开应用程序,他/她将被重定向到Google Play,如果用户在iOS上打开应用程序,他/她将被重定向到app Store页面 我相信这种行为是在分享应用商店链接时设计出来的,请看这个。那么我如何覆盖这种行为呢?我见过其他应用程序这样做。可能对你有用。你可能想使用ShareaPiReplicate的帖子,并链接到Facebook确认行为并声明他们可能不会修复它的网站。这不起作用。Android Facebook应用程序只是试图在自己的浏览器中打开URL,它打开的页面上显示Google Play不支持该浏览器。它应该在Google Play应用程序中打开应用程序的页面,但它没有。
<activity
android:name="com.example.client.MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<data android:scheme="example"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>