2013-03-12 81 views
3

我正在開發一款android遊戲。應用程序圖標在Android設備上不可見

它的工作正常,但我有一個問題,如果我刪除從我的android manifest下線,我的應用程序圖標是可見的。如果我不刪除這些行,那麼我的應用程序圖標在我的android上不可見。

<data android:host="mocha" android:path="/RTT/reset" 
    android:scheme="content" /> 

這是我原來的Android清單與圖標不可見:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="ihpc.mocha.rtt" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk 
     android:minSdkVersion="8" 
     android:targetSdkVersion="12" /> 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
    <uses-permission android:name="android.permission.READ_LOGS" /> 
    <uses-permission android:name="android.permission.READ_PHONE_STATE" /> 
    <application 
     android:name="com.game.rtt.RttGame" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:largeHeap="true" 
     android:theme="@android:style/Theme.NoTitleBar" > 
     <activity 
      android:screenOrientation="sensorLandscape" 
      android:name=".MainScene" 
      android:label="@string/title_activity_main_scene" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

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

       <!-- remove below lines to visible the icon start!!!--> 
      <data 
       android:host="mocha" 
       android:path="/RTT/reset" 
       android:scheme="content" /> 
      <!-- remove below lines to visible the icon end!!!--> 
      </intent-filter> 

     </activity> 

     <activity 
      android:name=".SessionTimeOutActivity" 
      android:label="@string/app_name" 
      android:screenOrientation="reverseLandscape"> 
      <intent-filter> 
       <action android:name="android.intent.action.VIEW" /> 

       <category android:name="android.intent.category.DEFAULT" /> 

       <data 
        android:host="mocha" 
        android:path="/RTT/sessionTimeOut" 
        android:scheme="content" /> 
      </intent-filter> 
     </activity> 
    </application> 

</manifest> 

請讓我知道同樣的原因嗎?

回答

14

由於"Using intent matching"

「意圖是針對意向匹配濾波器不僅要發現一個目標組件激活,同時也發現一些有關在設備上設置的組件。例如,Android系統。通過查找具有指定「android.intent.action.MAIN」動作和「android.intent」的意圖過濾器的所有活動來填充應用程序啓動器,即顯示可供用戶啓動的應用程序的頂級屏幕。 category.LAUNCHER「類別(如前一節所述),然後在啓動程序中顯示這些活動的圖標和標籤;同樣,通過使用」android.intent.category.H「查找活動來發現主屏幕OME「在其過濾器中。」

應用程序啓動器無法識別您的啓動器活動,因此您會爲您的活動假設一些數據。請在請求數據的位置添加一個新的意圖過濾器。

例子:

 <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.SEND"/> 
      <category android:name="android.intent.category.DEFAULT" /> 
      <data android:mimeType="application/json"/> 
     </intent-filter> 
+0

感謝回答+1的知識yoiu分享。希望它也會幫助別人:) – 2013-03-12 10:12:21

+0

也爲我工作。在我的Android應用中集成Google索引時,我遇到了同樣的問題。多謝,夥計。 :-) – 2015-11-17 13:23:53

2

它發生同樣的給我。您可以修復它添加數據標籤到另一個意圖過濾器是這樣的:

 <activity 
     android:screenOrientation="sensorLandscape" 
     android:name=".MainScene" 
     android:label="@string/title_activity_main_scene" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

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

      </intent-filter> 
     <intent-filter> 
      <data 
      android:host="mocha" 
      android:path="/RTT/reset" 
      android:scheme="content" /> 
     <!-- remove below lines to visible the icon end!!!--> 
     </intent-filter> 

    </activity> 
+0

感謝和+1的答案,但我需要理由,以及我從其他答案。 – 2013-03-12 10:13:01

0

我只是說此行發射活動的清單和圖標出現了:

<category android:name="android.intent.category.DEFAULT" /> 

它看起來像這樣:

<activity 
      android:name=".MainActivity" 
      android:label="@string/app_name"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.DEFAULT" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity>