【问题标题】:Android deep linking doesn't launch appAndroid 深度链接不会启动应用程序
【发布时间】:2014-05-18 01:29:14
【问题描述】:

我正在为此拉头发;说明看起来很简单,但它们根本不起作用。

这是清单活动意图代码:

<activity
    android:theme="@style/Theme.Buhzyellowtoplighttabs"
    android:name="com.blah.package"
    android:configChanges="orientation|keyboardHidden"
    android:windowSoftInputMode="adjustResize|stateHidden" 
    android:screenOrientation="portrait" >

    <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:scheme="http" android:host="www.buhz.com" />
    </intent-filter>

    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

所以你会认为,当我在手机上运行应用程序时,转到浏览器并转到 www.buhz.com 它应该给我一个启动应用程序的选项,对吗?

【问题讨论】:

  • 在你运行项目之后,你可以在这里复制粘贴控制台文本吗?
  • Logcat 还是 Gradle 日志?你正在寻找任何具体的东西,这是一个相当大的项目

标签: android android-intent deep-linking


【解决方案1】:

据我所知,这仅在您单击站点链接时有效,而不是在您输入 URL 时。

如果您正在测试的 Android 设备上阅读此内容,here 是您的链接

【讨论】:

  • 好答案,从来没想过,但现在我有另一个问题,如果我想允许用户从我的应用程序共享个人状态更新并且我的一个用户发送一个链接到一块内容(“www.buhz.com/updates/123”并且接收端的用户没有应用程序我如何将他们重定向到Play商店?
  • 说实话,我不太确定。我想你可以在网站上显示一个对话框,上面写着“你试过我们的 Android 应用程序了吗?你可以在这里下载它”并链接到应用程序商店,尽管它会显示给所有用户,即使是那些安装了应用程序的用户.有关 Play 商店链接格式的更多信息 here
  • 我想出了在相应的网址上重定向的想法,如果您没有应用程序,只需将它们重定向到 Playstore 列表
  • @ChuckKelly 你的想法实现了吗?你能分享你的想法和你是如何实现的吗?如果可能,请为此提供解决方案stackoverflow.com/questions/69393017/…
【解决方案2】:

这是对我有用的方法

androidmanifest文件内容如下:

<activity
        android:name=".SecondActivity"
        android:label="@string/title_activity_second">
        <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.example.com"
                android:pathPrefix="/roses"
                android:scheme="http" />

        </intent-filter>
    </activity>

终端输入的命令如下:

./adb shell am start -a android.intent.action.VIEW -d "http://www.example.com/roses" com.example.irfan.helloworld

注意: 如果您的操作系统是 Windows,您可以删除上述命令中的第一个“./”。

结果:

它自动打开了我的应用程序的“第二个活动”。

希望对你有帮助:)

【讨论】:

    【解决方案3】:

    对我来说:

    adb shell  am start  -W -a android.intent.action.VIEW  -d "example://gizmos" com.example
    

    没用。 添加类别解决了它:

    adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "http://www.example.com/gizmos"
    

    【讨论】:

    • 完美解决方案。谢谢。
    • 这是为了开发目的,PROD怎么样,开放,例如来自电子邮件?
    猜你喜欢
    • 1970-01-01
    • 2012-07-12
    • 1970-01-01
    • 1970-01-01
    • 2014-10-29
    • 1970-01-01
    • 1970-01-01
    • 2014-11-01
    • 1970-01-01
    相关资源
    最近更新 更多