获取动态链接,而不是深层链接-Android上的Firebase动态链接

时间:2019-06-22 09:30:46

标签: java android firebase firebase-dynamic-links

我已经创建了Firebase动态链接,例如:

dynamic link: https://my.dynamic.link
deep link: https://my.deep.link

当有人访问该动态链接时,它会打开我的应用程序(如果已安装)或打开Goog​​le Play来安装我的应用程序。

我没有使用android应用程序创建动态链接,但是我需要向同一动态链接添加参数,例如:

https://my.dynamic.link/?p1=a&p2=b
https://my.dynamic.link/?p3=c
https://my.dynamic.link/?p5=e&p6=f

现在我想要的是在我的android应用程序中检索完整的动态链接(而不是深层链接)。 Firebase docs提供了检索深层链接的正确方法。那不是我想要的。

FirebaseDynamicLinks.getInstance()
    .getDynamicLink(getIntent())
    .addOnSuccessListener(this, new OnSuccessListener<PendingDynamicLinkData>(){
      @Override
      public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
        if (pendingDynamicLinkData != null) {
            pendingDynamicLinkData.getLink(); // --> https://my.deep.link 

            /*
               what I want is the dynamic link with parameters
               https://my.dynamic.link/?p1=a&p2=b
            */
        }
      }
    });

有没有办法做到这一点?

1 个答案:

答案 0 :(得分:0)

获取不可能所有链接,但branch.io是你的工作可能的解决方案。 他得到的动态链接在Facebook,谷歌广告等。 你得到这样的:

{
      "identity_id": "427469360685348303",
      "link": "https://example.app.link?%24identity_id=427469360685348303",
      "session_id": "429691081177874743",
      "data": {
        "$canonical_identifier": "item/1503684554354.28",
        "$canonical_url": "https://example.com/home?utm_campaign=test&deeplink=value",
        "$desktop_url": "http://example.com/home",
        "$identity_id": "427469360685348303",
        "$og_description": "My Content Description",
        "$og_image_url": "http://lorempixel.com/200/200/",
        "$og_title": "46D6D28E-0390-40E4-A856-BD74F34D24C8",
        "$publicly_indexable": 1,
        "+click_timestamp": 1503684563,
        "+clicked_branch_link": true,
        "+is_first_session": false,
        "+match_guaranteed": true,
        "custom": "blue",
        "random": "FE848A5B-78F7-42EC-A253-9F795FE91692",
        "added": "1503684554354.33",
        "~campaign": "new launch",
        "~channel": "facebook",
        "~creation_source": 3,
        "~feature": "sharing",
        "~id": 429691043152332059,
        "~referring_link": "https://example.app.link/X7OsnWv9TF",
        "~stage": "new person",
        "~tags": [
          "one",
          "two"
        ]
      }
    }