【问题标题】:Pass multiple params via Firebase Dynamic links Android通过 Firebase 动态链接传递多个参数 Android
【发布时间】:2017-04-29 06:32:12
【问题描述】:

我使用了 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(pass=def 丢失) 有人解决这个问题吗?

【问题讨论】:

    标签: android firebase firebase-dynamic-links firebase-invites


    【解决方案1】:

    需要URL encodelink参数的值,否则系统无法分辨动态链接的参数是什么,动态链接的link参数的子参数是什么.

    这意味着最终到达网址应类似于https://xx.app.goo.gl/?link=http%3A%2F%2Fxx.com%2F%3Fusn%3Dabc%26pass%3Ddef&apn=com.xx&afl=http://google.com

    重要提示:如果您(我怀疑)尝试将用户名和密码作为明文链接参数传递,这是一个非常糟糕的主意。说真的,不要这样做。阅读this answer,了解处理此类需求的正确方法。

    【讨论】:

    【解决方案2】:

    只要你传入 url:

    https://link.example.com?param="value1"&param2="value2" ...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-04-04
      • 2021-12-12
      • 1970-01-01
      • 2012-11-23
      • 1970-01-01
      • 2019-04-18
      • 2020-06-19
      • 2021-08-25
      相关资源
      最近更新 更多