2012-10-24 44 views
3

我已經實現了URL Scheme的代碼,如下所示在manifest.xml中。此代碼不適用於任何瀏覽器。自定義URL計劃不啓動android應用程序

<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方案與任何瀏覽器或我在上面的代碼更改爲這個問題是什麼。

+1

你確定這不是相反的方式。第一個代碼有效,第二個代碼不可用?請參閱我的問題http://stackoverflow.com/q/13042278/1503155,我想我們有同樣的問題。 –

回答

2

要第一次編碼:添加android:pathPattern=".*"應該修復http方案。

第二個代碼:對於Chrome,您必須使用intent:語法。 Chrome不會收聽自定義方案(不再)。

+0

讓你能詳細說明你的第二點 - 我無法讓我的應用程序從任何瀏覽器啓動 - – Tom

相關問題