【问题标题】:adb deep link trigger not working with certain parametersadb 深层链接触发器不适用于某些参数
【发布时间】:2017-06-07 12:33:13
【问题描述】:

我的应用程序包名称为com.xxx.digital

以下工作正常:

❯ adb shell am start -W -a android.intent.action.VIEW -d "xxx://?campaign=SG_Smartbanner" com.xxx.digital 
Starting: Intent { act=android.intent.action.VIEW dat=xxx://?campaign=SG_Smartbanner pkg=com.xxx.digital }
Status: ok
Activity: com.xxx.digital/.views.activities.ProductListingActivity
ThisTime: 827
TotalTime: 1669
WaitTime: 1699
Complete

但是,以下不是:

❯ adb shell am start -W -a android.intent.action.VIEW -d "xxx://?campaign=SG_Smartbanner&media_source=Mobilesite" com.xxx.digital 
/system/bin/sh: com.xxx.digital: not found

❯ adb shell am start -W -a android.intent.action.VIEW -d "xxx://?campaign=SG_Smartbanner&af_deeplink=true" com.xxx.digital
/system/bin/sh: com.xxx.digital: not found
Starting: Intent { act=android.intent.action.VIEW dat=xxx://?campaign=SG_Smartbanner }
Status: ok
Activity: android/com.android.internal.app.ResolverActivity
ThisTime: 322
TotalTime: 322
WaitTime: 349
Complete

我在这里缺少什么?

清单.xml

<activity
            android:name=".views.activities.DeepLinkActivity"
            android:launchMode="singleInstance"
            android:noHistory="true"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:windowSoftInputMode="stateAlwaysHidden">

            <!-- custom scheme -->
            <intent-filter
                android:autoVerify="true"
                android:label="@string/app_name">
                <action android:name="android.intent.action.VIEW"/>

                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>

                <data
                    android:scheme="xxx"/>
            </intent-filter>
</activity>

【问题讨论】:

    标签: android android-intent deep-linking


    【解决方案1】:

    如果您使用特殊字符,则必须用引号将您的 adb shell 命令括起来:

    adb shell 'am start -W -a android.intent.action.VIEW -d "xxx://?campaign=SG_Smartbanner&af_deeplink=true" com.xxx.digital'
    

    【讨论】:

    • 只是好奇,我尝试对 URL 进行编码,但它也不起作用。我认为 urlencoding 也会处理特殊字符。你知道为什么这种方法行不通吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-13
    • 1970-01-01
    • 2015-04-07
    • 1970-01-01
    相关资源
    最近更新 更多