我正在尝试从一个(示例)链接打开我的应用:
// AndroidManifest.xml
<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.movieseat.app">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:name="com.movieseat.app.MainActivity"
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBarLaunch"
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="@@string/title_activity_main">
<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 "http://www.example.com/gizmos” -->
<data
android:scheme="http"
android:host="www.example.com"
android:pathPrefix="/gizmos" />
<!-- note that the leading "/" is required for pathPrefix-->
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
</provider>
</application>
<!-- Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
正如您所看到的,当我导航到http://www.example.com/gizmos
时,应该会出现深层链接
我通过USB连接了我的Pixel 5,我可以在adb
中找到它,然后运行以下命令:
adb shell am start -W -a android.intent.action.VIEW -d“http://www.example.com/gizmos“
我已经创建了一个.apk
的项目,并安装了一个我的手机,但当我运行上述命令谷歌chrome打开并加载页面http://http://www.example.com/gizmos
这是运行adb
命令时控制台的输出:
Starting: Intent { act=android.intent.action.VIEW dat=http://www.example.com/... }
Status: ok
LaunchState: WARM
Activity: com.android.chrome/org.chromium.chrome.browser.ChromeTabbedActivity
TotalTime: 220
WaitTime: 232
Complete
我错过了什么?
1条答案
按热度按时间6qfn3psc1#
将软件包名称添加到
adb
命令修复了该问题:adb shell am start -W -a android.intent.action.VIEW -d“http://www.example.com/gizmos“com.movieseat.app