点击启动我的Android应用程序时,我有以下链接。
在活动中,我可以https://whatever.com/customers?id=MTgy(使用FirebaseDynamicLinks
)。但是如何获得整个原始链接?
答案 0 :(得分:2)
// [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);
}
你可以从链接获得的是现在只执行动作你想要执行什么