我们正在尝试实施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" …Run Code Online (Sandbox Code Playgroud)