简体   繁体   中英

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?

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM