0

I wanted to provide a Companion Configuration Activity for my Android Wear watch face. I have already build the app that has all the configuration and can communicate directly with the watch face, but I can only launch it from the launcher as app, but the gear does not show up in the watch face section of Android Wear app! Can I allow user to configure the watch face via companion app and also via Google Android Wear app?

This is how I declare my activity in phone module:

    <activity
        android:name=".Main"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.SEND"></action>
            <category android:name="android.intent.category.DEFAULT"></category>
            <data android:mimeType="image/*"></data>
        </intent-filter>
    </activity>

On the watch part, I added in:

        <meta-data
            android:name=
            "com.google.android.wearable.watchface.companionConfigurationAction"
            android:value=
                "virtualgs.photowatch.Main" />

        <meta-data
            android:name=
                "com.google.android.wearable.watchface.wearableConfigurationAction"
            android:value=
                "virtualgs.photowatch.Main" />

And the result is the same - no gear shown on the Android Wear app.

Lim Thye Chean
  • 8,704
  • 9
  • 49
  • 88

3 Answers3

2

Try something like this:

Phone Manifest:

<intent-filter>
        <action android:name="com.virtualgs.photowatch.MAIN_CONFIG" />
        <category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
        <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

Watch Manifest:

    <meta-data
            android:name="com.google.android.wearable.watchface.companionConfigurationAction"
            android:value="com.virtualgs.photowatch.MAIN_CONFIG" />

I think the intent action in the phone manifest has to be the same as the meta-data value in the watch manifest to work.

0

I think this is the correct answer about XML file config:

<activity
android:name=".DigitalWatchFaceWearableConfigActivity"
android:label="@string/digital_config_name">
<intent-filter>
    <action android:name=
        "com.example.android.wearable.watchface.CONFIG_DIGITAL" />
    <category android:name=
    "com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

  • This is for the watch, right? The one that I used is for phone. You can see here: https://developer.android.com/training/wearables/watch-faces/configuration.html – Lim Thye Chean Jul 26 '15 at 06:38
0

As well as having the activity defined in the phone module, you need to reference it in the wear module as part of the declaration of your watch face service like this:

<service
android:name=".MyWatchFaceService" ... />
<!-- companion configuration activity -->
<meta-data
    android:name=
       "com.google.android.wearable.watchface.companionConfigurationAction"
    android:value=
       "com.my.watchface.CompanionConfigurationActivity" />
<!-- wearable configuration activity -->
<meta-data
    android:name=
       "com.google.android.wearable.watchface.wearableConfigurationAction"
    android:value=
       "com.my.watchface.WearableConfigurationActivity" />
...

Replacing com.my.watchface.CompanionConfigurationActivity and com.my.watchface.WearableConfigurationActivity with the fully qualified names of the configuration activities in the wear and phone modules respectively.

StevenR
  • 396
  • 3
  • 8
  • Thanks for the help. Since I only want the configuration on the phone, I thought only the com.google.android.wearable.watchface.companionConfigurationAction part is needed? – Lim Thye Chean Jul 28 '15 at 01:32
  • I updated my watch XML to use your example, but replaced com.my.watchface.CompanionConfigurationActivity with my app name virtualgs.photowatch.Main (which is the main activity), the result is the same. – Lim Thye Chean Jul 28 '15 at 01:34