[英]Android deep linking, cannot filter intent with scheme 'android-app'
我正在关注App Indexing API文档 。 我的应用程序URI是android-app://com.mypackagename.app/intro/intro/
,因此我将其添加到清单文件中的<activity>
<activity
android:name=".MainActivity"
android:label="@string/config_app_name"
android:screenOrientation="portrait"
android:enabled="true"
android:exported="true"
>
<intent-filter android:label="test">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="android-app"
android:host="com.mypackagename.app" />
</intent-filter>
</activity>
但是,当按照“在手机上测试您的深层链接”中所述测试我的深层链接时,无法打开android-app://com.mypackagename.app/intro/intro/
链接,有一个吐司说:“有没有安装可以处理的应用程序”
我想念什么? 谢谢
更新:在Mattia指出的文档中,绝对可以选择放置任何方案,例如“ example”,但对我来说不起作用。 如果有帮助,我在棒棒糖上。
<intent-filter android:label="@string/filter_title_viewgizmos">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "example://gizmos" -->
<data android:scheme="example"
android:host="gizmos" />
</intent-filter>
更新2 :包之后的任何东西都是方案,在我的例子中, android-app://com.mypackagename.app/intro/intro/
,它是intro
。 下方标记为答案
您应该使用您的域,而不是android-app
和您的软件包,如文档中所示 。
试试这个例子:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test">
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:windowSoftInputMode="stateVisible">
<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="yourdomain"
android:scheme="example" />
</intent-filter>
<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="www.yourdomain.com"
android:scheme="http" />
</intent-filter>
</activity>
</application>
</manifest>
比这里用这些值测试(用应用程序的包名称更改com.example.test
):
android-app://com.example.test/http/www.yourdomain.com/page
android-app://com.example.test/example/yourdomain/page
当您扫描条形码并按链接时,您的应用程序将自动打开。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.