gpt4 book ai didi

android - 动态链接提取

转载 作者:行者123 更新时间:2023-11-29 19:06:13 24 4
gpt4 key购买 nike

单击启动我的 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

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

最佳答案

// [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);
}

你可以从链接中得到的是这个只是现在执行你想执行的操作

关于android - 动态链接提取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47135135/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com