当我创建包含 UTM 参数的动态链接并共享它时,我能够从链接中检索数据和编码查询。但是,当我尝试使用 firebase 推荐的方法创建动态链接的短链接时,我只能检索路径,但不能检索编码查询。我该如何解决?
创建动态链接的方法:
public void buildReferral() {
DynamicLink dynamicLink = FirebaseDynamicLinks.getInstance().createDynamicLink()
.setLink(Uri.parse("sample link"))
.setDynamicLinkDomain("sample domain")
.setAndroidParameters(
new DynamicLink.AndroidParameters.Builder("com.package.my")
.build())
.setGoogleAnalyticsParameters(
new DynamicLink.GoogleAnalyticsParameters.Builder()
.setSource("referral")
.setContent("content")
.setMedium("Android")
.build())
.buildDynamicLink();
buildShortUrl(dynamicLink);
}
创建短链接的方法:
public void buildShortUrl(DynamicLink dynamicLink) {
Task<ShortDynamicLink> shortLinkTask = FirebaseDynamicLinks.getInstance().createDynamicLink()
.setLongLink(Uri.parse(dynamicLink.getUri().toString()))
.buildShortDynamicLink()
.addOnCompleteListener(this, new OnCompleteListener<ShortDynamicLink>() {
@Override
public void onComplete(@NonNull Task<ShortDynamicLink> task) {
if (task.isSuccessful()) {
// Short link created
Uri shortLink = task.getResult().getShortLink();
Uri flowchartLink = task.getResult().getPreviewLink();
} else {
// Error
// ...
}
}
});
}