Tax*_*Noi 3 android deep-linking android-app-indexing
我正在关注App Indexing API doc。我的应用程序 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>
Run Code Online (Sandbox Code Playgroud)
但是当按照在我的手机上测试您的深层链接中所述去测试我的深层链接时,该链接android-app://com.mypackagename.app/intro/intro/
无法打开,吐司说“没有安装可以处理它的应用程序”
我错过了什么?谢谢
更新:在 Mattia 指出的文档中,绝对可以选择放置任何方案,例如“示例”,但它对我不起作用。我在棒棒糖上,如果它有所作为。
<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>
Run Code Online (Sandbox Code Playgroud)
更新 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>
Run Code Online (Sandbox Code Playgroud)
在这里使用这些值进行测试(com.example.test
随应用程序的包名称更改):
android-app://com.example.test/http/www.yourdomain.com/page
android-app://com.example.test/example/yourdomain/page
Run Code Online (Sandbox Code Playgroud)
当您扫描条形码并按下链接时,您的应用程序将自动打开。
归档时间: |
|
查看次数: |
3094 次 |
最近记录: |