Microsoft Graph 中的设备中继 API(预览版)Device relay API in Microsoft Graph (preview)

当今,人们每天都会与多个设备进行交互。Today, people interact with multiple devices on a daily basis. 用户通常会在一个设备上开始生产任务和娱乐活动,并在另一个设备上继续进行。Users often start productivity tasks and entertainment activities on one device and continue them on another. 为了满足客户的各种需求,你的应用需要能够无缝跨多个设备和平台。To meet your customers' needs, your apps need to seamlessly span devices and platforms.

你可以使用设备中继 API 为用户提供无缝体验,You can use the device relay APIs to deliver seamless experiences to your users. 让他们积极地将体验从一个设备转移到另一个设备,或者一次使用多个设备提升体验。You can make it possible for them to actively transfer an experience from one device to another or enhance it by using multiple devices at once. 这可以通过应用内操作(应用中的按钮或选择)来完成,通过调用设备中继 API 来发现用户设备,并使其能够在其他设备上启动和向应用发送消息。This is done via in-app actions (a button or selection in your app) that call the device relay API to discover users' devices, and enable them to launch and message your app on those other devices.

为什么与设备中继集成?Why integrate with device relay?

设备中继 API 能够让应用自行注册,并在用户设备上发现、命令应用以及向其发送消息。The device relay API enables your app to register itself, and discover, command, and message your app on the user's devices. 通过集成,你可以将客户所处理的任务置于中心焦点。By doing this, you can make the tasks your customers work on the central focus. 通过发现设备并将任务转移到该设备上,客户即可在他们最为便捷的设备上继续工作。They can work on the device that is most convenient for them by discovering it and transferring tasks to it. 另外,他们还可以通过使用周围的其他设备来增强应用的持续体验。They can also enhance an ongoing experience with your app by using other devices around them.

你可以将设备中继 API 用于配套设备或远程控制应用场景。You can use the device relay API for companion devices, or remote control scenarios. 使用消息功能在两台设备之间创建应用频道以发送和接收自定义消息。Use the messaging capabilities to create an app channel between two devices to send and receive custom messages. 例如,可以让客户使用自己的手机控制电视的播放。For example, you can enable your customers to use their phone to control playback on a TV. 而且,当用户在 PC 上处理应用的主视图时,通过在手机上显示基于上下文的常用操作,还可以在工作效率场景中提供配套应用。You could also provide a companion app in a productivity scenario by displaying context-based commonly used actions on a phone while your users work on the main view of your app in the PC.

通过在应用中执行操作,客户还可以主动将体验从一个设备转移到另一个设备。Your customers can also actively transfer an experience from one device to another by performing an action in your app. 例如,某位用户在公交车上用手机在观看现场直播,但当她到家后,她可能想要转到客厅中的电脑上播放。For example, a user might be watching a live broadcast on her phone while on the bus, but when she gets home she wants to transfer playback to the PC in her living room. 设备中继也支持工作效率应用场景。Productivity scenarios are also supported by device relay.

扩展体验Extend the experience

通过提供 UX 来发现设备并在这些设备上启动应用,从而扩展应用。Extend your app by providing UX to discover devices and to launch your app on those devices. 例如,用户可以在她的手机上处理采购订单,在她的办公室发现 PC,并在其上启动应用来完成采购订单输入。For example, the user could be working on a purchase order on her phone, discover the PC in her office, and launch the app there to finish entering the purchase order.

增强体验Augment the experience

在用户的另一个设备上为应用创建配套体验。Create a companion experience for your app on another of the user’s devices. 例如,应用可以包含 UX 以在其他设备上自启动。For example, the app could include UX to launch itself on other devices. 在游戏中,用户可以将应用启动到有较大屏幕的设备上(例如,从 PC 到 Xbox)。In a game, the user could launch the app to a device with a larger screen (for example, from a PC to an Xbox). Xbox 可以呈现游戏的完整视图(第一人称视角),而屏幕较小的设备可以呈现不同的视角和附加背景(游戏关卡的顶级视角,显示玩家与对手的位置)。The Xbox could present a full view of the game (a first-person view), while the device with the smaller screen could present a different view with additional context (a top-level view of the game level showing the player and opponents' locations).

丰富体验Enrich the experience

为应用添加其他控制功能。Add additional controlling abilities to your app. 例如,从配套设备为主应用提供远程控制功能。For example, provide remote control abilities for the main app from a companion device. 当用户将应用从一个设备启动到另一个设备时,目标设备可以显示完整体验(例如,设计应用中的 3D 模型),而源设备可以显示目标设备上给定应用状态的最常用操作的列表(例如旋转、调整大小、调色板)。When the user launches an app from one device to another, the target device could show the full experience (for example, a 3D model in a design app), while the source device could show a list of the most common actions given the state of the app on the target device (for example, rotate, resize, color palette).

另请参阅See also