【问题标题】:Android Wear watch face companion configuration activity not linkedAndroid Wear 表盘伴侣配置活动未关联
【发布时间】:2015-01-30 02:58:04
【问题描述】:

我已经根据官方 API 更新了我的 Android Wear 表盘,总体来说它运行良好。然而,我坚持的一件事是从 Android Wear 应用程序中启动配套(手持)配置活动。我只是无法在 AW 应用程序的表盘预览图像上显示“齿轮”图标 - AW 无法识别我的配置链接。

需要明确的是,这个应用程序的所有其他部分都运行正常;该应用程序在两个设备上运行良好,表盘工作,数据 API 工作,自动安装工作。只是这个指向我的设置活动的链接被破坏了。

这是我的手持应用清单的相关部分:

 <activity
    android:name=".google.WatchfaceSettingsActivity"
    android:label="@string/pref_wear_wf_title" >
    <intent-filter>
        <action android:name="com.mypackage.google.CONFIG_WEAR_WATCHFACE" />
        <category android:name="com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>

这是我的可穿戴应用清单的匹配位:

<service
    android:name=".wear.WatchFaceService"
    android:label="@string/app_name"
    android:permission="android.permission.BIND_WALLPAPER" >
    <meta-data
        android:name="android.service.wallpaper"
        android:resource="@xml/watch_face" />
    <meta-data
        android:name="com.google.android.wearable.watchface.companionConfigurationAction"
        android:value="com.mypackage.google.CONFIG_WEAR_WATCHFACE" />
    <intent-filter>
        <action android:name="android.service.wallpaper.WallpaperService" />
        <category
            android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
    </intent-filter>
</service>

据我了解,关键部分是 com.mypackage.google.CONFIG_WEAR_WATCHFACE 字符串,它出现在两个清单中。在我看来一切都很好 - 是不是我缺少一些愚蠢的东西?

【问题讨论】:

    标签: wear-os watch-face-api


    【解决方案1】:

    几乎正确,但您的手持设备 Activity 的意图过滤器类别似乎被错误地设置为 WEARABLE_CONFIGURATION。应该是:

    com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION
    

    更多信息:http://developer.android.com/training/wearables/watch-faces/configuration.html

    【讨论】:

    • 就是这样 - 我复制了错误的过滤器。呸!我只需要另一双眼睛来查看我的代码。非常感谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多