我使用了 Firebase Dynamics 链接,它可以打开我的应用程序、转到 Play 商店或转到 URL。但是当我通过链接传递一些参数时,我只能获取第一个参数。
这是我的动态链接:
https://xx.app.goo.gl/?link=http://xx.com/?usn=abc&pass=def&apn=com.xx&afl=http://google.com
我使用此代码来获取链接:
// Build GoogleApiClient with AppInvite API for receiving deep links
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, this)
.addApi(AppInvite.API)
.build();
// Check if this app was launched from a deep link. Setting autoLaunchDeepLink to true
// would automatically launch the deep link if one is found.
boolean autoLaunchDeepLink = false;
AppInvite.AppInviteApi.getInvitation(mGoogleApiClient, this, autoLaunchDeepLink)
.setResultCallback(
result -> {
if (result.getStatus().isSuccess()) {
// Extract deep link from Intent
Intent intent = result.getInvitationIntent();
String deepLink = AppInviteReferral.getDeepLink(intent);
Logger.e(deepLink);
}
}
);
和日志打印:http://xx.com/?usn=abc http://xx.com/?usn=abc(通行证=def丢失了)
有人解决这个问题吗?
你需要URL编码 http://www.w3schools.com/Tags/ref_urlencode.asp的价值link
参数,否则系统无法区分什么是动态链接的参数,什么是动态链接的子参数link
动态链接的参数。
这意味着最终的 URL 应该是这样的https://xx.app.goo.gl/?link=http%3A%2F%2Fxx.com%2F%3Fusn%3Dabc%26pass%3Ddef&apn=com.xx&afl=http://google.com
重要的提示:如果您(正如我怀疑的那样)尝试将用户名和密码作为明文链接参数传递,那么这是一个非常糟糕的主意。严重地,不要这样做. Read 这个答案 https://stackoverflow.com/a/39672655/5394680对于这样的要求的正确方法。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)