2012-08-13 164 views
1

IM有一個奇怪的問題,而不是在那裏一個URL應該啓動我的應用程序,它加載應用程序到瀏覽器本身,在這種情況下進入mozella!Android 4.0的啓動應用程序無法正常工作

這裏是意圖過濾器我用我的應用程序如果有人能告訴我什麼即時做錯了。

<uses-sdk android:minSdkVersion="15" /> 
<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 

<application 
    android:name=".Globals" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" > 
    <activity 
     android:name=".RSS_ViewerActivity" 
     android:label="@string/app_name" > 
     <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" /> 
       <data android:scheme="itpc" /> 
       <data android:scheme="pcast" /> 
       <data android:scheme="feed" /> 
       <data android:scheme="feeds" /> 
       <data android:scheme="rss" /> 
     </intent-filter> 

     <intent-filter> 
       <action android:name="android.intent.action.VIEW" /> 
       <category android:name="android.intent.category.DEFAULT" /> 
       <data android:mimeType="text/xml" android:scheme="http" /> 
       <data android:mimeType="application/rss+xml" android:scheme="http" /> 
       <data android:mimeType="application/atom+xml" android:scheme="http" /> 
       <data android:mimeType="text/xml" android:scheme="https" /> 
       <data android:mimeType="application/rss+xml" android:scheme="https" /> 
       <data android:mimeType="application/atom+xml" android:scheme="https" /> 
     </intent-filter> 

    </activity> 
    <activity android:name="RSSFeedActivity"></activity> 
    <activity android:name="com.CertificateAuthentication.Authenticator"></activity> 
</application> 

謝謝。

UPDATE

稍微多一些的信息,當對話框,詢問是否要選擇和應用,以打開彈出鏈接起來,它並不曾顯示我的應用程序,或任何與此有關。

UPDATE

我刪除了第二和第三意圖過濾器,我試圖將2個其餘意圖過濾器合併成1,但是這不加載來自瀏覽器的應用程序。上面的代碼是什麼樣子現在讓我相同的結果=前(這是煩人的,因爲它意味着用戶可以在應用程序運行的2次會議,一個從瀏覽器和一個從發射器。

回答

0

你第二和第三<intent-filter>元素可能無法正常工作,因爲android:host未記錄支持通配符。這裏

+0

乾杯但是,不幸的是沒有工作=( 我試圖改變動作爲主,但不工作的對話框,詢問是否要選擇一個應用程序犯規不斷顯示我的應用程序! – 2012-08-13 13:44:15

0

問題是\,這是轉義字符,所以讓你需要\\這個表達式的工作。 Documentation clearly says,你需要使用\\.爲點(有例如用\\*)。

我也同意CommonsWare答案,我在documentation這樣的表述已經發現:

所有這些屬性是可選的,但它們不是獨立的 對方:對於權力是有意義的,一個方案還必須指定 。爲了使路徑有意義,必須指定方案和權威 。

而且The host and port together constitute the URI authority所以在實踐中權力意味着主機所以你不能省略,顯然你不能把一個明星出現。

IMO你讓它變得複雜,你不需要在這裏定義路徑! MIME類型應該做這項工作。嘗試找到一些讀取RSS的開源項目,看看他們如何定義清單。

我想你需要類似的東西:

<activity 
    android:name=".RSS_ViewerActivity" 
    android:label="@string/app_name" > 
    <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.BROWSABLE" /> 
     <category android:name="android.intent.category.DEFAULT" /> 
     <data android:scheme="itpc" /> 
     <data android:scheme="pcast" /> 
     <data android:scheme="feed" /> 
     <data android:scheme="feeds" /> 
     <data android:scheme="rss" /> 
     <data android:mimeType="text/xml" android:scheme="http" /> 
     <data android:mimeType="application/rss+xml" android:scheme="http" /> 
     <data android:mimeType="application/atom+xml" android:scheme="http" /> 
     <data android:mimeType="text/xml" android:scheme="https" /> 
     <data android:mimeType="application/rss+xml" android:scheme="https" /> 
     <data android:mimeType="application/atom+xml" android:scheme="https" /> 
    </intent-filter> 

</activity> 
+0

感謝您的幫助,我拿出那些2個意圖過濾器,你和commonsware的建議,我已經更新了我上面的帖子。 我仍然會得到相同的結果,雖然=(我也嘗試過從另一個瀏覽器,股票安卓一,我得到的應用程序的相同結果從瀏覽器查看,而不是啓動/恢復,如果它是運行。 – 2012-08-14 08:25:34

相關問題