简体   繁体   English

在Android Wear应用中将设置添加到WatchFace

[英]Add settings to WatchFace in Android Wear app

I noticed that some WatchFaces have an option "Get Companion App", clicking on this setting Android Wear leads user to Google Play page of the relevant application. 我注意到有些WatchFaces具有“获取伴侣应用程序”选项,单击此设置,Android Wear会将用户引导至相关应用程序的Google Play页面。

How is it possible to implement so? 如何实现呢?

This question is really too broad to provide a complete answer here. 这个问题的确涉及面太广,无法在此处提供完整的答案。 But at a high level, here's how you'd implement it: 但是,从高层次上讲,这是实现方式:

  1. Create a separate app on the handheld, probably built around a PreferenceScreen . 在掌上电脑上创建一个可能围绕PreferenceScreen构建的单独应用。 This is your companion app. 这是您的伴侣应用。
  2. Use the Wear Data API to send those Preference values to your watch face. 使用Wear Data API将这些Preference值发送到您的表盘。
  3. On the watch side, listen for changes to your preference data and modify your face accordingly. 在手表方面,侦听您的偏好数据的更改并相应地修改您的脸部。
  4. Package the watch face app within the handheld companion app for distribution on Google Play (or wherever). 将表面应用程序打包到手持式配套应用程序中,以在Google Play(或任何地方)上分发。

Obviously, there are a lot of details to each step - but they're all well documented elsewhere. 显然,每个步骤都有很多细节-但在其他地方都有充分的文献记载。 I'd also suggest that you look at (or build from) Google's example watch face app, https://developer.android.com/samples/WatchFace , which includes a handheld configuration app. 我还建议您查看Google的示例表面应用程序https://developer.android.com/samples/WatchFace (或从其构建),该应用程序包括一个手持式配置应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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