Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass multiple params via Firebase Dynamic links Android

I've used Firebase Dynamics link and it can open my app, go to play store or go to an URL. But when I pass some parameters through link, I can only get first parameter. Here's my dynamic links:

https://xx.app.goo.gl/?link=http://xx.com/?usn=abc&pass=def&apn=com.xx&afl=http://google.com

And I used this code to get the link:

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

And the log print: http://xx.com/?usn=abc (the pass=def was lost) Anyone resolve this issue?

like image 975
maphongba008 Avatar asked Dec 14 '16 02:12

maphongba008


People also ask

How many dynamic links can I create Firebase?

To receive Dynamic Links in your app, see the documentation for iOS, Android, C++, and Unity. Requests are limited to 5 requests/IP address/second, and 200,000 requests/day. If exceeded, then the response will return HTTP error code 429. To request for more quota, fill out this form.

Do Firebase dynamic links expire?

As far as I know, dynamic links work for as long as your firebase project active. I used some dynamic links more than one year after they were created. I didn't see anything about any time limits in the documentation.

How do I get data from Firebase dynamic link?

To receive the Firebase Dynamic Links that you created, you must include the Dynamic Links SDK in your app and call the FirebaseDynamicLinks. getDynamicLink() method when your app loads to get the data passed in the Dynamic Link.


1 Answers

You need to URL encode the value of the link parameter, otherwise the system can't tell what is a parameter of the Dynamic Link and what is a sub-paramater of the link parameter of the Dynamic Link.

This means the final URL should look like https://xx.app.goo.gl/?link=http%3A%2F%2Fxx.com%2F%3Fusn%3Dabc%26pass%3Ddef&apn=com.xx&afl=http://google.com

Important note: if you are (as I suspect) attempting to pass usernames and passwords through as plaintext link parameters, this is an incredibly bad idea. Seriously, do not do this. Read this answer for the proper approach to a requirement like this.

like image 130
Alex Bauer Avatar answered Nov 14 '22 23:11

Alex Bauer