Atul Dhawan
Atul Dhawan

Reputation: 91

App Launcher Icon Disappears from screen

I was trying to set the intent filters for a simple app to handle urls. I applied the basic tags for "intent-filter" like "action" ,"category".

Here I used 2 "intent-filter" tags.

<activity
        android:name=".MyBrowserActivity"
        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" />
           <data android:scheme="http" />
           <category android:name="android.intent.category.BROWSABLE"/>
           <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
</activity>

But the Launcher icon is not shown after instaling if I apply intent filters as shown below in just 1 "intent-filter" tag.

<activity
        android:name=".MyBrowserActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="http" />
            <category android:name="android.intent.category.BROWSABLE"/>
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
</activity>

The main question here I wanted to ask is "Why the app launcher icon disappears in the second case when there is just 1 "intent-filter".

Upvotes: 9

Views: 2174

Answers (3)

Sandro Wiggers
Sandro Wiggers

Reputation: 4693

As mentioned by @praneetloke, is just to separate into different <intent-filter> groups. I felt that it was missing an example, so here it goes. Hope it helps.

<activity android:name=".activities.RegisterActivity" android:launchMode="singleTask">
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
  <intent-filter  android:autoVerify="true">
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data android:host="path365.page.link" android:scheme="https"/>
    <data android:host="path365.page.link" android:scheme="http"/>
  </intent-filter>
</activity>

Upvotes: 0

Sang-Kil Park
Sang-Kil Park

Reputation: 136

Split intent-filter into two activities:

    <activity
        android:name=".MainActivity">
        <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="main"
                android:scheme="example" />
        </intent-filter>
    </activity>
    <activity
        android:name=".SplashActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

Upvotes: 2

Orphamiel
Orphamiel

Reputation: 884

You need to split the intent filter up into two. So you have

<INTENT FILTER>
Action category 
</INTENT FILTER>
<INTENT FILTER>
Action category data
</INTENT FILTER>

Upvotes: 18

Related Questions