如何在佩戴手表中单击按钮时在移动设备中启动应用程序?

How to lauch the app in mobile while a button clicked in wear watch?

我是开发 android 磨损应用程序的新手。我想知道如何通过在 android wear watch 中接收按钮点击来在移动设备中执行操作? 例如,用于在移动设备中启动 activity 的磨损应用程序中的按钮。

这种情况有两种情况..

1.By 在通知中按下操作按钮。
2.By 在 Wear 应用程序中按下按钮。

在情况 1 中,您可以从 android(phone) 应用程序生成通知,您无需为 watch.Into 编写代码,我们可以提供 PendingIntent。 http://developer.android.com/training/wearables/notifications/creating.html

在情况 2 中,在创建可穿戴应用程序并包含 button.But 之后,我们无法在 on_click.The 可穿戴数据层 API,它是 Google Play 服务的一部分,使用消息 Api/Data Api 为您的手持设备和可穿戴设备 apps.By 提供通信渠道,我们正在与 phone 开始一个 activity.Suppose 当我们通过单击该按钮发送带有一些适当数据(从 wear 到 phone)的消息时,将在 phone 中触发 onMessageRecieved 方法,在该方法中你可以提供一些 Intent 和 Start Activity。 http://developer.android.com/training/wearables/data-layer/index.html