首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >动态链接提取

动态链接提取
EN

Stack Overflow用户
提问于 2017-11-06 18:47:49
回答 1查看 288关注 0票数 1

当单击启动我的android应用程序时,我会看到以下链接。

https://example.app.goo.gl/?link=https://whatever.com/customers?id=MTgy&token=MTI2MzI1M&apn=com/foo.bar&isi=1045116743&ibi=com.foo.bar&efr=1

在本活动中,我可以(使用FirebaseDynamicLinks)获取https://whatever.com/customers?id=MTgy。但是我如何获得整个原始链接呢?

EN

回答 1

Stack Overflow用户

发布于 2017-11-06 18:54:28

代码语言:javascript
复制
// [START get_deep_link] in OnCreate() method
    FirebaseDynamicLinks.getInstance()
            .getDynamicLink(getIntent())
            .addOnSuccessListener(this,this) //implement OnSuccessListener<PendingDynamicLinkData> for this
            .addOnFailureListener(this,this); // implement OnFailureListener for this




   @Override
   public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
    // Get deep link from result (may be null if no link is found)
    Uri deepLink = null;
    if (pendingDynamicLinkData != null) {
        deepLink = pendingDynamicLinkData.getLink();
    }
    // Handle the deep link. For example, open the linked
    // content, or apply promotional credit to the user's
    // account.
    // ...

    // [START_EXCLUDE]
    // Display deep link in the UI
    if (deepLink != null) {
        //now you have your dynamicLink here in Uri object
    } else {
        Log.e(TAG, "getDynamicLink: no link found");
    }
    // [END_EXCLUDE]
   }

  @Override
  public void onFailure(@NonNull Exception e) {
    Log.e(TAG, "getDynamicLink:onFailure", e);
  }

您可以从link获得的只是现在执行操作您要执行什么操作

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47135135

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档