Use*_*ser 9 android deep-linking
深度链接在 Android 中不起作用。我已将清单代码粘贴到此处。当我测试时,它会访问网站,而不是在我的应用程序中打开我的活动。有人可以帮我解决这个问题吗?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.clinicloud.app" >
<application
android:name=".MainApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<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.XXXX.com"
android:pathPrefix="/xyz"
android:scheme="http"/>
</intent-filter>
</activity>
<activity
android:name=".OnboardingActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ProfileViewActivity"
android:label="@string/title_activity_profile_view"
android:theme="@style/AppTheme.NoActionBar" >
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
更新:
adb shell am start -W -a android.intent.action.VIEW -d " http://www.clinicloud.com/xyz " com.clinicloud.app
使用 adb 测试会打开应用程序,但仅使用浏览器测试不会打开应用程序。
将此代码添加到Manifest.xml
<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.clinicloud.com"
android:path="/xyz"
android:scheme="http" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
为了测试创建另一个项目并运行下面的代码
Intent i = new Intent(
Intent.ACTION_VIEW , Uri.parse("http://www.clinicloud.com/xyz")
);
startActivity(i);
Run Code Online (Sandbox Code Playgroud)
您还可以在链接中传递参数。有关详细信息,请参阅我的博客文章在 Android 浏览器中创建链接来启动我的应用程序吗?
| 归档时间: |
|
| 查看次数: |
12837 次 |
| 最近记录: |