Why full/long dynamic link is not getting retrieved/received?
Asked Answered
R

3

2

I'm creating a deep/dynamic link following this github project.

Here's the link which is getting created: https://appcode.app.goo.gl/?link=http://example.com/-example&apn=com.abc.xxx&amv=16&ad=0&extraParameter=null

This is the method I'm using for sharing it:

private void shareDeepLink(String deepLink) {
            Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("text/plain");
            intent.putExtra(Intent.EXTRA_SUBJECT, "Firebase Deep Link");
            intent.putExtra(Intent.EXTRA_TEXT, deepLink);

            itemView.getContext().startActivity(intent);
}

This is the intent-filters defined in my app's AndroidManifest.xml file:

<intent-filter>
      <action android:name="android.intent.action.VIEW"/>

      <category android:name="android.intent.category.DEFAULT"/>
      <category android:name="android.intent.category.BROWSABLE"/>

      <data android:host="example.com" android:scheme="http"/>
      <data android:host="example.com" android:scheme="https"/>
</intent-filter>

This is how I'm trying to receive the shared deep-link:

boolean autoLaunchDeepLink = false;
        AppInvite.AppInviteApi.getInvitation(mGoogleApiClient, this, autoLaunchDeepLink)
                .setResultCallback(
                        new ResultCallback<AppInviteInvitationResult>() {
                            @Override
                            public void onResult(@NonNull AppInviteInvitationResult result) {
                                if (result.getStatus().isSuccess()) {
                                    // Extract deep link from Intent
                                    Intent intent = result.getInvitationIntent();
                                    final String deepLink = AppInviteReferral.getDeepLink(intent);
                                    Log.d("deepLinkMainActivity", deepLink);

                                } else {
                                    Log.d("getInvitation", "getInvitation: no deep link found.");
                                }
                            }
                        });

Here's what is getting logged out (received deep-link): http://example.com/-example

As you can clearly see, I'm not getting the exact deep-link which was created and instead I'm getting it's altered version. Why?

And how can I get exactly the same deep-link which was created and shared?

Ruebenrueda answered 7/2, 2017 at 15:38 Comment(6)
Do you mean that the line 'Log.d("deepLinkMainActivity", deepLink);' outputs 'example.com/-example'? I think that is exactly what you should expect with a link that you provided. Can you please tell what do you expect to see?Deltoid
Your intent filter defines scheme "https", but you use "http" in your link. That is one thing that could cause problems.Deltoid
@Deltoid I expect to see this whole thing: https://appcode.app.goo.gl/?link=http://example.com/-example&apn=com.abc.xxx&amv=16&ad=0&extraParameter=nullRuebenrueda
That is not the purpose. In the original url you can even give different url to be given to browser and to the app with &al= and you can also provide fallback link.Deltoid
@Deltoid I want to add extra query parameters and then retrieve them later when the link is received. How to?Ruebenrueda
did you find any solution for this?Carmody
B
2

You are reciving the deeplink properly

This is the complete link generated that contains info like the apn : the package name of your app, the information to know for example which app need to be opened

https://appcode.app.goo.gl/?link=http://example.com/-example&apn=com.abc.xxx&amv=16&ad=0&extraParameter=null

This is your deeplink link=http://example.com/-example. So, if you want to add more parameters you can do it here, like in the example bellow

link=http://example.com/-example&blabla.

So you have this as result https://appcode.app.goo.gl/?link=http://example.com/-example&blabla&apn=com.abc.xxx&amv=16&ad=0

If you want this portion can be encoded http://example.com/-example&blabla

You can try this and let me know.

You can refer this info here https://firebase.google.com/docs/dynamic-links/android

Budwig answered 7/2, 2017 at 21:39 Comment(4)
I have added more parameters as told by you, now how can I retrieve them when I receive the link?Ruebenrueda
Did you see the extra parameters in the deeplink when call AppInvite.AppInviteApi.getInvitation if true, so can use a parse to get the parameters, maybe and split of "&". Right now i dont have an example because right now i am using Branchio.Scow
I'm unable to understand what you said here.. ^Ruebenrueda
I have explained the problem much clearly here: https://mcmap.net/q/1021109/-unable-to-query-parameters-stored-in-a-firebase-dynamic-deep-link/6144372 Please have a look.Ruebenrueda
M
0

replace

<data
       android:host="xxx.abc.com"
       android:scheme="https"/>

with

<data
       android:host="example.com"
       android:scheme="http"/>
Mordent answered 8/2, 2017 at 11:1 Comment(2)
There is no issues on use http or httpsScow
then there must be issue of host nameMordent
C
0

I also faced this problem. The issue was the link which I'm receiving is "Long link". We can create two types of links from firebase:

  1. Short Link https://appcode.app.goo.gl/[email protected]
  2. Long Link https://appcode.app.goo.gl/?link=http://example.com/-example&apn=com.abc.xxx&amv=16&ad=0&extraParameter=null

So that's why I'm facing this issue. I solved it by fetching the whole link from

 Uri uriData = intent.data

And to fetch particular query param from the link:

  String email = uriData.getQueryParameter("email")

I hope it will help anyone!!

Carmody answered 4/6, 2020 at 19:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.