【问题标题】:App does not open when run scheme on Chrome/Firefox在 Chrome/Firefox 上运行方案时应用程序无法打开
【发布时间】:2014-09-22 03:33:50
【问题描述】:

我想使用 scheme 启动我的 Android 应用,这是我的代码:

<activity
        android:name="com.myapp.SplashScreenActivity"
        android:alwaysRetainTaskState="true"
        android:label="@string/app_name"
        android:noHistory="true" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <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.myhost.com"
                android:pathPrefix="/company/"
                android:scheme="http" />
            <data
                android:host="myhost.com"
                android:pathPrefix="/company/"
                android:scheme="http" />
        </intent-filter>
    </activity>

然后在浏览器和结果上运行:myhost.com/company/:

  • 默认网络浏览器:应用正常打开
  • Chrome:不工作
  • Firefox:不工作。

我不知道如何解决,请帮我解释一下。

【问题讨论】:

    标签: android


    【解决方案1】:

    您不应该使用“http”作为方案,因为 Chrome 和 Firefox 可以处理这种 URL,它们不会调用其他应用程序来处理它。相反,您可以使用那些浏览器无法处理的自定义方案,例如“myprotocol”,它们会调用您的应用程序来处理它。您可以在 Chrome 上运行“myprotocol://myhost.com/company/”进行测试。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-09
      • 2015-05-20
      • 1970-01-01
      • 1970-01-01
      • 2015-05-25
      • 2020-07-29
      • 2019-11-08
      • 1970-01-01
      相关资源
      最近更新 更多