具有多个查询参数的 Android 深度链接

标签 android adb deep-linking

我正在尝试深度链接我的应用,并在我的 AndroidManifest.xml 中实现了以下内容以打开正确的 Activity 。

<activity
    android:name=".ui.activities.MyActivity"
    android:label="@string/title_activity"
    android:screenOrientation="portrait">
    <!-- ATTENTION: This intent was auto-generated. Follow instructions at
    https://g.co/AppIndexing/AndroidStudio to publish your Android app deep links. -->
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <!-- ATTENTION: This data URL was auto-generated. We recommend that you use the HTTP scheme.
        TODO: Change the host or pathPrefix as necessary. -->
        <data
            android:host="myHost"
            android:scheme="myCustomScheme" />
    </intent-filter>
</activity>

我正在使用 adb 测试 Activity

adb shell am start -W -a android.intent.action.VIEW -d "myCustomScheme://myHost?key=category_parent_id&value=92&title=test" com.myApp.android

Activity 正在打开,但在 Intent 中传递给 Activity 的 URI 只是

myCustomScheme://myHost?key=category_parent_id

它跳过'&'之后的所有内容

我确实在 SO 上查找了这里,但没有找到具有多个查询参数的任何内容。

最佳答案

使用 adb 测试时,只需在 & 符号前添加 \ 即可。

复制这个:

adb shell am start -W -a android.intent.action.VIEW -d "myCustomScheme://myHost?key=category_parent_id\&value=92\&title=test"com.myApp.android

关于具有多个查询参数的 Android 深度链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35645414/

相关文章:

android - 如何设置Android环境变量让app继承?

xcode 11 beta5 和 swiftui 上的深度链接

php - 如何将 MySQL 数据库连接数据以名称值对的形式从 Android 传递到 PHP

android - 如何在 phonegap 上使用 GCM 处理 android 中的多个推送通知

android - ADB 连接到 Android TV/Nvidia Shield TV?

android - adb 服务器版本与此客户端不匹配

android - Android未深层链接到Google Play

ios - 如何在 Swift 3 中使用自定义 URL 方案打开我的 iOS 应用程序?

iphone - html5 <audio> : how to use the built-in `next` , 和 `previous` 控件在 iOS 4.2/Android 2.3

java - 安卓,Java : HTTP POST Request