Facebook:使用“共享"对话框共享Play商店链接 [英] Facebook: sharing a Play Store link using the Share Dialog

查看:156
本文介绍了Facebook:使用“共享"对话框共享Play商店链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Facebook Android SDK中的共享对话框共享链接.我的代码如下:

I share a link using the share dialog from the Facebook Android SDK. My code looks like this:

FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
          .setName("My app name")
          .setCaption("A caption")
          .setDescription("My description...")
          .setLink("https://play.google.com/store/apps/details?id=com.company.myapp")
          .setPicture("http://link_to_picture")
          .build();

当我希望将用户重定向到我的应用程序的Play商店页面时,我将此URL放在了链接中.但是在那种情况下,该帖子不会显示我指定的信息(名称,标题,描述).而是显示Play商店中指定的应用名称,并带有下载"标题(图片可以).

As I want users to be redirected to my app's Play Store page, I put this url in the link. But in that case, the post doesn't show the information I specified (name, caption, description). Instead, it shows the app name specified in the Play Store, with a "download it" caption (the picture is ok).

当我设置另一个链接时,不会发生此问题:该帖子按预期显示名称,标题和描述.为什么我不能在Play商店链接中输入自己的文字?

When I set another link, this issue doesn't occur: the post displays the name, caption and description as expected. Why can't I put my own text with a Play Store link?

编辑

我尝试使用App Links.因此,我创建了一个App Link对象:

I tried using App Links. So I created an App Link object with this:

curl https://graph.facebook.com/app/app_link_hosts \
-F access_token="APP_ACCESS_TOKEN" \
-F name="My app link" \
-F android=' [
    {
      "url" : "myapp://share/1234",
      "package" : "com.company.myapp",
      "app_name" : "My app",
    },
 ]' \
-F web=' {
    "should_fallback" : false,
  }'

我得到了这个网址: https://fb.me/494085890722766

现在,该帖子看起来不错,但是当未安装我的应用程序时,从Facebook应用程序单击它会弹出一个选择器,建议您在浏览器中打开链接或安装该应用程序,这不是很好的用户体验.

Now, the post looks good, but clicking on it from Facebook app when my app is not installed pops up a chooser that proposes to open the link in a browser or install the application, which is not a good user experience.

推荐答案

最后,我找到了使用App Links的变通方法,在此处进行了详细介绍:

Finally, I found a workaround using App Links, which is detailed here : https://developers.facebook.com/docs/applinks/hosting-api

我创建了我的App Link对象,而没有任何"-F web"参数,如下所示:

I created my App Link object without any "-F web" parameter, like this:

curl https://graph.facebook.com/app/app_link_hosts \
-F access_token="APP_ACCESS_TOKEN" \
-F name="My app link" \
-F android=' [
    {
      "url" : "myapp://share/1234",
      "package" : "com.company.myapp",
      "app_name" : "My app",
    },
 ]'

但是,我不明白为什么Facebook API如此奇怪地起作用.这是一个简单问题的复杂解决方案.

However, I don't understand why Facebook API works in a so weird way. It's a complicated solution to a simple issue.

这篇关于Facebook:使用“共享"对话框共享Play商店链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆