这是我在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/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);
Run Code Online (Sandbox Code Playgroud)
当URL是一些随机网站(如developers.facebook.com)时,这很有用,但是当它是Google Play的链接时,内容标题和内容描述会被覆盖 - 标题会被Play商店的标题和内容描述覆盖是空白的.
那么如何链接到Play商店的应用程序,但保留自定义标题和描述?我知道这是可能的,因为我见过其他应用程序这样做:
