Mic*_*idt 10 android deep-linking
我们正在尝试实施Google的应用程序索引功能.我们使用以下格式的rel-alternate标记添加了指向我们网站的深层链接:
android-app://id.of.the.app/scheme/?screen=Product&product=123456
Run Code Online (Sandbox Code Playgroud)
现在我们收到内容不匹配抓取错误.如果我从这里使用二维码进行测试,一切正常.但是,如果我打开爬行错误,请单击"打开应用页面"并使用adb命令进行测试我可以看到从&符号开始的所有内容都没有传递到应用程序,因此无法加载我的产品数据.我怀疑爬虫是如何检查应用程序的内容的,这就是我们收到内容不匹配错误的原因.
此外,如果我使用搜索控制台中的"抓取为Google",则"&"符号中的所有内容都会被切断.
我检查了eBay,因为它正在使用他们的应用程序,这是他们正在使用的链接:
android-app://com.ebay.mobile/ebay/link/?nav=item.view&id=221559043026&referrer=http%3A%2F%2Frover.ebay.com%2Froverns%2F1%2F711-13271-9788-0%3Fmpcl%3Dhttp%253A%252F%252Fwww.ebay.com%252Fitm%252FRoxy-Fairness-Backpack-Womens-Red-RPM6-%252F221559043026%253Fpt%253DLH_DefaultDomain_0
Run Code Online (Sandbox Code Playgroud)
他们编写了&符号,&但如果我这样做并使用"Fetch as Google"功能测试它也不起作用.
这些用户似乎有同样的问题,但他们没有共享解决方案(如果他们找到了一个):
https://productforums.google.com/forum/#!msg/webmasters/5r7KdetlECY/enYknTVkYU4J https://productforums.google.com/forum/#!topic/webmasters/lswyXKlS-Ik
我很感激任何想法.
更新1
这就是我在解释Android应用中的深层链接的方式:
Uri data = getIntent().getData();
String scheme = data.getScheme();
if (scheme.equals("scheme")) {
String screen = data.getQueryParameter("screen");
if (screen.equals("Product")) {
String product = data.getQueryParameter("product");
// Open Product and give it product number as intent data
}
}
Run Code Online (Sandbox Code Playgroud)
更新2
这是我们Manifest.xml的相关部分:
<activity
android:name="id.of.the.app.StartActivity"
android:configChanges="orientation|screenSize"
android:label="@string/app_title"
android:windowSoftInputMode="adjustPan|stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="scheme" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
更新 3
我仍在尝试了解是否可以避免更改清单并重新提交应用程序。使用您发布的 AndroidManifest,您是否尝试仅更改 rel-alternate 标记以包含主机(如果未包含在清单中,则为事件)?例如,您是否尝试过android-app://id.of.the.app/scheme/fakehost/?screen=Product&product=123456where fakehost is a string?我猜想标签的语法一定是android-app://{package_name}/{scheme}/{host_path}这样的,所以在网站上有一个主机是必要的(但可能不在应用程序上)。
更新2
在您发布清单后,我猜您在意图过滤器的数据标签中缺少必需的“主机”。
将此作为参考:
<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:scheme="myapp" android:host="link"/>
<data android:scheme="myapp" android:host="link/"/>
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
html 中的元应该是 (android-app://package-name/scheme/host)
<html>
<head>
<link rel="alternate"
href="android-app://it.test.testdeeplink/myapp/link/?p1=1&p2=2" />
...
</head>
Run Code Online (Sandbox Code Playgroud)
您可能需要更新您的应用程序,因为您的清单必须修复。
首先,感谢所有的澄清。我猜想深层链接(您正在实现的功能)和Chrome 意图(您作为评论提供的链接)存在一些混淆。因此,我决定实现一个小项目,您可以通过我的dropbox 文件夹下载该项目。该项目非常简单,只有一个活动,为 Intent 数据接收到的每个参数打印一行(当然,如果您通过应用程序启动器启动应用程序,您将看不到任何内容)。该 Activity 支持两种意图过滤器模式(my-android-app 和 http),在 MainActivity.java 的末尾您可以找到(作为注释)
由于我无权访问您的代码,并且我无法查看是否存在任何问题,我想这是帮助您并让我的答案被接受的最佳方法:)
| 归档时间: |
|
| 查看次数: |
5555 次 |
| 最近记录: |