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

# Cloud Aware API 呼び出し

> Cloud Aware API 呼び出し

このトピックを使用して、Cloud Aware タイトルがストリーミング可能かどうかを検出し、XBOX Game Streaming 向けに[ゲームを最適化](https://docs.xbox.com/ja-jp/build/core-features/common/game-streaming/game-streaming-optimizing-your-game.md)できるようにします。

## ストリーミング用にゲームをセットアップする

ゲームの初期化時に、次のコードに示すように `XGameStreamingInitialize` を使用してゲーム ストリーミング コンポーネントをセットアップしていることを確認してください。

```C++ theme={null}

// Initialize the game streaming component
XGameStreamingInitialize();

```

現在接続されているアクティブなストリーミング クライアントがあるかどうかを検出するには、次のコードに示すように `XGameStreamingIsStreaming` を使用します。

```C++ theme={null}
 if (XGameStreamingIsStreaming())
 {
     // The game is currently streaming to at least one device
     // Enable any customizations that might be useful when running from the cloud
 }
```

## 接続状態の管理

アクティブなストリーミング クライアントがある場合、`XGameStreamingIsStreaming` を使用すると、その時点でのクライアントの状況をゲームが把握できます。ストリーミング クライアントがゲームに接続または切断されたときに通知を受け取るには、[XGameStreamingRegisterConnectionStateChanged](https://docs.xbox.com/ja-jp/reference/system/xgamestreaming/functions/xgamestreamingregisterconnectionstatechanged.md) を使用します。

## リファレンス API ドキュメント

* [XGameStreaming (API contents)](https://docs.xbox.com/ja-jp/reference/system/xgamestreaming/xgamestreaming_members.md)
  * 関数
    * [XGameStreamingRegisterConnectionStateChanged](https://docs.xbox.com/ja-jp/reference/system/xgamestreaming/functions/xgamestreamingregisterconnectionstatechanged.md)

## 関連項目

[XGameStreaming (API contents)](https://docs.xbox.com/ja-jp/reference/system/xgamestreaming/xgamestreaming_members.md#connection-state)
[ゲームの最適化](https://docs.xbox.com/ja-jp/build/core-features/common/game-streaming/game-streaming-optimizing-your-game.md)


## Related topics

- [XBOX Game Streaming の開発のベスト プラクティス](https://docs.xbox.com/ja-jp/build/core-features/common/game-streaming/game-streaming-optimizing-your-game.md)
- [CloudScript から Webhook 呼び出しを行う](https://docs.xbox.com/ja-jp/services/playfab/live-service-management/service-gateway/automation/cloudscript/making-webhook-calls-from-cloudscript.md)
- [カスタム CloudScript の作成](https://docs.xbox.com/ja-jp/services/playfab/live-service-management/service-gateway/automation/cloudscript/writing-custom-cloudscript.md)
- [クイックスタート (Windows) - PlayFab サービスの呼び出し](https://docs.xbox.com/ja-jp/services/playfab/sdks/unified-sdk/quickstart-services.md)
- [XSAPI C API で非同期呼び出しを行う](https://docs.xbox.com/ja-jp/services/xbox-services/fundamentals/xbox-services-api/live-flatc-async-patterns.md)
