我怎样才能从Facebook图形API规范网址中的android? [英] How can i get canonical url from facebook graph api in android?

查看:324
本文介绍了我怎样才能从Facebook图形API规范网址中的android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想实现我的android的applcation在Facebook上分享的深度链接。这深层链接只为移动而不是网页。因此,根据Facebook的文档链接1 链路2 我经历链路2。下面应该叫得到规范网址的ID。该规范的URL将被设置为在Facebook上分享链接。

要获得规范的标识

 卷曲https://graph.facebook.com/app/app_link_hosts \
-F access_token =APP_ACCESS_TOKEN\
-F名称=Android的应用链接对象的实例\
-F机器人=[
    {
      URL:sharesample://故事/ 1234,
      包:com.facebook.samples.sharesample
      APP_NAME:ShareSample,
    },
  ]\
-F网络='{
    should_fallback:假的,
  }
 

要获得规范网址从规范标识

 卷曲-G https://graph.facebook.com/YOUR_APP_LINK_HOST_ID \
-d access_token =APP_ACCESS_TOKEN\
-d栏= canonical_url \
-d pretty的=真
 

我不知道该怎么称呼这个,我不知道这个术语的 app_link_hosts Android应用程序的链接对象的实例 YOUR_APP_LINK_HOST_ID 这里实际上意味着。谁能解释如何调用该实例。谢谢你。

解决方案
  1. app_link_hosts是实际的图形路径请求的一部分,所以不要改变它,只是把它当作是(/应用程序/ app_link_hosts的完整路径)。

  2. Android应用程序的链接对象的实例是要创建的URL的名称。这是只有您的利益,并没有真正用于任何东西,所以你可以把任何你想有(我会保持一个可读的字符串)。

  3. YOUR_APP_LINK_HOST_ID是从第一卷曲命令的结果。第一个curl命令将返回您的字符串ID,并且使用在第二个命令得到规范网址(你可以用它来分享)。

Am trying to implement deep link on Facebook sharing in my android applcation. That deep link is only for mobile and not for webpage. So according to the facebook documentation Link1 Link2 am going through Link2. The following should be called to get id of canonical url. This canonical url will be set as a link on Facebook sharing.

To get canonical id

curl https://graph.facebook.com/app/app_link_hosts \
-F access_token="APP_ACCESS_TOKEN" \
-F name="Android App Link Object Example" \
-F android=' [
    {
      "url" : "sharesample://story/1234",
      "package" : "com.facebook.samples.sharesample",
      "app_name" : "ShareSample",
    },
  ]' \
-F web=' {
    "should_fallback" : false,
  }'

To get canonical url from canonical id

curl -G https://graph.facebook.com/YOUR_APP_LINK_HOST_ID \
-d access_token="APP_ACCESS_TOKEN" \
-d fields=canonical_url \
-d pretty=true

I don't know how to call this and i don't know the terms app_link_hosts, Android App Link Object Example, YOUR_APP_LINK_HOST_ID here actually means. Can anyone explain how to call this with example. Thank you.

解决方案

  1. app_link_hosts is part of the actual graph path for the request, so don't change it, and just use it as is (/app/app_link_hosts is the full path).

  2. "Android App Link Object Example" is the name of the url you're creating. It's for your benefit only, and is not really used for anything, so you can put anything you'd like there (I would keep it a human readable string).

  3. "YOUR_APP_LINK_HOST_ID" is the result from the first curl command. The first curl command will return you a string ID, and you use that in the second command to get the canonical url (that you can use to share).

这篇关于我怎样才能从Facebook图形API规范网址中的android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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