androidandroid-manifestcustom-url

My Android App is not showing on the App Drawer


I have an application with a single activity:

<activity android:name=".MainActivity"
    android:label="@string/app_name"
    android:screenOrientation="landscape"
    android:launchMode="singleTask"
    android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <category android:name="com.google.intent.category.CARDBOARD" />

        <data android:scheme="myscheme" android:host="action1"/>
        <data android:scheme="myscheme" android:host="action2"/>
        <data android:scheme="myscheme" android:host="action3"/>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
    </intent-filter>
    <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>

I need it to respond to myscheme:// urls, and it is working in that regard. Unfortunately, it does not show in my App Drawer. If I remove the android:scheme lines, then it shows on the App Drawer, but then it no longer responds to myscheme:// urls, obviously.

How can I fix this activity to make it both show on the app drawer and respond to the custom urls?


Solution

  • Try splitting the intent-filter into two:

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
    
    </intent-filter>
    <intent-filter>
        <category android:name="com.google.intent.category.CARDBOARD" />
            <data android:scheme="myscheme" android:host="action1"/>
            <data android:scheme="myscheme" android:host="action2"/>
            <data android:scheme="myscheme" android:host="action3"/>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>