为什么完整/长期的动态链接没有得到检索/接收? [英] Why full/long dynamic link is not getting retrieved/received?

查看:176
本文介绍了为什么完整/长期的动态链接没有得到检索/接收?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这个 github 项目。

下面是创建的链接: https://appcode.app.goo.gl/?link=http://example。 com / -example& apn = com.abc.xxx& amv = 16& ad = 0& extraParameter = null



我用它来分享它:

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

这是 intent-filters 定义在我的应用程序的 AndroidManifest.xml 文件中:

 < ;意图滤光器> 

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

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

这就是我想要接收共享的深层链接

  boolean autoLaunchDeepLink = false; 
AppInvite.AppInviteApi.getInvitation(mGoogleApiClient,this,autoLaunchDeepLink)
.setResultCallback(
new ResultCallback< AppInviteInvitationResult>(){
@Override $ b $ public void onResult(@ NonNull AppInviteInvitationResult结果){
if(result.getStatus()。isSuccess()){
//从Intent提取深层链接
Intent intent = result.getInvitationIntent();
final String deepLink = AppInviteReferral.getDeepLink(intent);
Log.d(deepLinkMainActivity,deepLink);

} else {
Log.d(getInvitation, getInvitation:找不到深层链接);
}
}
});

以下是注销的内容(收到深度链接): http: //example.com/-example



您可以清楚地看到,我没有得到创建的确切深度链接,相反,我得到它的改变版本。为什么?



我怎样才能得到完全相同的被创建和共享的深层链接?


<解决方案

这是完整的链接生成,其中包含像apn的信息:你的应用程序的包名,要知道哪些应用程序需要打开的信息

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



这是您的深层链接
link = http://example.com/-example 。所以,如果你想添加更多的参数,你可以在这里做,如在下面的例子



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

所以你有这个结果 https://appcode.app.goo.gl/?link=http://example.com/-example&blabla&apn=com.abc.xxx&amv=16&ad=0

如果你想要这部分可以编码 http://example.com/-example&blabla



您可以试试这个,让我知道。



您可以在 https://firebase.google。 com / docs / dynamic-links / android


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?

解决方案

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

这篇关于为什么完整/长期的动态链接没有得到检索/接收?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆