> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XR-109 应用之间的链接

> 当链接到控制台上的另一个应用时,游戏必须包含目标用户的上下文,以便链接的应用以正确的已登录用户打开。

# XR-109:应用之间的链接

版本 1.0,2020/3/1

当链接到控制台上的另一个应用时,游戏必须包含目标用户。

## 更多信息

当在应用或游戏之间链接时,必须在原始游戏和被链接到的应用之间保持正确的用户上下文。如果一个用户的游戏链接到成就应用,应显示同一用户的成就,而不是其他用户的成就,也不应要求当前用户登录到成就应用以继续。

当从一个游戏或应用链接到另一个时,如以下示例所示,游戏必须将目标用户的上下文传递到 `LaunchUriAsync` 调用中:

```cpp theme={null}
auto uriString = ref new Platform::String(L"cubesra://default");
auto uri = ref new Windows::Foundation::Uri(uriString);
auto options = ref new Windows::System::LauncherOptions();
options->Context = _currentUser;
Windows::System::Launcher::LaunchUriAsync(uri, options);
```

传递目标用户的上下文可确保应用在该用户的上下文中启动,并且用户会看到预期的内容。未能传递用户上下文将导致系统选择一个用户上下文来启动应用,这通常可能不正确,特别是在多个用户登录到系统或有新用户在游戏内登录或切换上下文的情况下。

在应用之间链接时,用户期望在游戏和应用之间保持正确的用户上下文。例如,如果游戏中的按钮标记为"显示我的成就",用户会期望该按钮不仅将他们带到成就应用,还带到属于他们的成就应用版本,包含他们已解锁的所有内容。在同一时间可能有多个用户登录的控制台上,游戏有责任在链接到系统上的另一个应用或游戏时传递正确的用户。


## Related topics

- [XBOX 要求 (XR) 认证参考](/zh-CN/publishing/certification/xbox-requirements.md)
- [PFLeaderboardsUnlinkLeaderboardFromStatisticAsync](/zh-CN/services/playfab/api-references/c/pfleaderboards/functions/pfleaderboardsunlinkleaderboardfromstatisticasync.md)
- [XR-007 跨网络游戏、数据使用和配套应用](/zh-CN/publishing/certification/xr/xr-007.md)
- [XR-017 游戏分级](/zh-CN/publishing/certification/xr/xr-017.md)
- [XR-015 管理玩家通信](/zh-CN/publishing/certification/xr/xr-015.md)
