[英]Android deep linking, cannot filter intent with scheme 'android-app'
I'm following the App Indexing API doc . 我正在关注App Indexing API文档 。 My app URI is
android-app://com.mypackagename.app/intro/intro/
, so I add this to the manifest file, under <activity>
我的应用程序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>
But when go and test my deep link as said in Test your deep link on my phone, the link android-app://com.mypackagename.app/intro/intro/
can't be opened, there's a toast saying "there are no apps installed that can handle it" 但是,当按照“在手机上测试您的深层链接”中所述测试我的深层链接时,无法打开
android-app://com.mypackagename.app/intro/intro/
链接,有一个吐司说:“有没有安装可以处理的应用程序”
What am I missing? 我想念什么? Thanks
谢谢
Update: in the documentation pointed out by Mattia, there's definitely an option to put whatever scheme, like 'example', but it doesn't work for me. 更新:在Mattia指出的文档中,绝对可以选择放置任何方案,例如“ example”,但对我来说不起作用。 I'm on Lollipop, if it makes a difference.
如果有帮助,我在棒棒糖上。
<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>
Update 2 : anything after the package is the scheme, in my case, android-app://com.mypackagename.app/intro/intro/
, it is intro
. 更新2 :包之后的任何东西都是方案,在我的例子中,
android-app://com.mypackagename.app/intro/intro/
,它是intro
。 Marked answer below 下方标记为答案
You should use your domain, not android-app
and your package as you can see in the documentation . 您应该使用您的域,而不是
android-app
和您的软件包,如文档中所示 。
Try this example: 试试这个例子:
<?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>
Than test here with these values (change com.example.test
with the package name of your app): 比这里用这些值测试(用应用程序的包名称更改
com.example.test
):
android-app://com.example.test/http/www.yourdomain.com/page
android-app://com.example.test/example/yourdomain/page
When you scan the bar code and press the link, your app will open automatically. 当您扫描条形码并按链接时,您的应用程序将自动打开。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.