Search code examples
androidwear-oswatchhuawei-mobile-services

App doesn't show up in the apps menu on Huawei Watch 2


I'm implementing an application in Android Studio. I'm running into a problem using my Huawei Watch 2. The app works fine, but I don't understand why it doesn't show up in the apps menu on the watch.

Going to Settings -> Apps and notifications -> Info app, I see my app.

What is happening, and how can I fix it?

Here is my Manifest.xml file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.prova._poc">

    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <uses-feature android:name="android.hardware.type.watch" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@android:style/Theme.DeviceDefault"
        tools:ignore="GoogleAppIndexingWarning"
        tools:targetApi="ice_cream_sandwich">

        <service
            android:name=".MyfirebaseMessagingService" android:exported="false" >
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT"/>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            </intent-filter>
        </service>

        <service
            android:name=".MyFirebaseInstanceIDService" android:exported="false">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
            </intent-filter>
        </service>

        <uses-library
            android:name="com.google.android.wearable"
            android:required="true" />
        <!--
               Set to true if your app is Standalone, that is, it does not require the handheld
               app to run.
        -->
        <meta-data
            android:name="com.google.android.wearable.standalone"
            android:value="true" />

        <!-- [START fcm_default_channel] -->
        <!-- [START fcm_default_channel] -->
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_channel_id"
            android:value="@string/default_notification_channel_id" />

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

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

                <data
                    android:host="gizmos"
                    android:scheme="example" />
            </intent-filter>
        </activity>
        <activity android:name=".Splash">

            <intent-filter>
                <action android:name="Splash" />
                    <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

    </application>

</manifest>

Solution

  • Your main Activity's manifest entry is wrong. Specifically, for it to appear in the app launcher on any Android device, it needs an <intent-filter> element that looks like this:

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

    I'm not sure why you have all the other stuff in there, but if you need it, create a second <intent-filter> element for it. You can have several intent-filters for a given <activity>, matching different intents - but the one for the launcher should only contain the action and category shown here.

    More info here: https://developer.android.com/guide/components/intents-filters.html