【问题标题】:Custom URL Scheme not launching the android application自定义 URL 方案未启动 android 应用程序
【发布时间】:2012-10-24 05:40:08
【问题描述】:

我已经在 manifest.xml 中实现了 URL Scheme 的代码,如下所示。此代码不适用于任何浏览器。

<activity
        android:name=".Event"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Black.NoTitleBar"
        android:windowSoftInputMode="adjustPan|stateAlwaysVisible" >
        <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="xyz" />
        </intent-filter>
    </activity>

以下代码仅适用于默认浏览器。

<activity
        android:name=".Event"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Black.NoTitleBar"
        android:windowSoftInputMode="adjustPan|stateAlwaysVisible" >
        <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="xyz"  />
        </intent-filter>
    </activity>

所以,请给我一个解决方案,让我可以在任何浏览器上使用自定义 URL 方案,或者我必须为这个问题在上面的代码中更改什么。

【问题讨论】:

标签: android url url-scheme


【解决方案1】:

到第一个代码:添加 android:pathPattern=".*" 应该为 http 方案修复它。

对于第二个代码:对于 Chrome,您必须使用 intent: 语法。 Chrome 不再监听自定义方案(不再)。

【讨论】:

  • Jean 您能否详细说明您的第二点 - 我根本无法从任何浏览器启动我的应用程序 -
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-22
  • 2014-07-09
  • 1970-01-01
  • 1970-01-01
  • 2014-04-07
相关资源
最近更新 更多