GCKDiscoveryManager クラス
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
デバイス検出プロセスを管理するクラス。
GCKDiscoveryManager は GCKDeviceProvider サブクラス インスタンスのコレクションを管理します。各インスタンスは特定のタイプのデバイスの検出を担当します。また、現在検出されたデバイスの辞書順のリストも保持します。
フレームワークは、アプリがフォアグラウンドに移動すると検出プロセスを自動的に開始し、アプリがバックグラウンドに移動すると一時停止します。一般的に、アプリが startDiscovery (GCKDiscoveryManager) と stopDiscovery (GCKDiscoveryManager) を呼び出す必要はありません。ただし、アプリのキャスト機能を使用しない領域で、ネットワーク トラフィックと CPU 使用率を削減する最適化手段として呼び出す場合は除きます。
アプリケーションが GCKUICastButton を介して、または直接表示することで、フレームワークの Cast ダイアログを使用している場合、そのダイアログは GCKDiscoveryManager を使用して、利用可能なデバイスのリストを入力します。ただし、アプリが独自のデバイス選択/制御ダイアログ UI を提供している場合は、GCKDiscoveryManager とその関連リスナー プロトコル GCKDiscoveryManagerListener を使用して、利用可能なデバイスのリストを入力および更新する必要があります。
- 発足
- 3.0
NSObject を継承します。
検出通知を受け取るリスナーを追加します。
- Parameters
-
listener | The listener to add. |
以前に登録されたリスナーを削除します。
- Parameters
-
listener | The listener to remove. |
- (BOOL) isDiscoveryActiveForDeviceCategory: |
|
(NSString *) |
deviceCategory |
|
指定されたデバイス カテゴリで検出が現在アクティブかどうかをテストします。
- (GCKDevice *) deviceAtIndex: |
|
(NSUInteger) |
index |
|
マネージャーの検出されたデバイスのリストで、指定されたインデックスにあるデバイスを返します。
- (GCKDevice *__nullable) deviceWithUniqueID: |
|
(NSString *) |
uniqueID |
|
マネージャーの検出されたデバイスのリストで、指定された一意の ID を持つデバイスを返します。
- Parameters
-
uniqueID | The device's unique ID. |
- 戻り値
- 一致する GCKDevice オブジェクト。一致するデバイスが見つからなかった場合は
nil
。
- (GCKDiscoveryState) discoveryState |
|
readnonatomicassign |
- (BOOL) hasDiscoveredDevices |
|
readnonatomicassign |
このオブジェクトで管理されている検出プロバイダによってデバイスが検出されたかどうかを示すフラグ。
検出で「パッシブ」スキャンを使用するかどうかを示すフラグ。
パッシブ スキャンはリソース消費量が少ないですが、アクティブ スキャンほど新しい結果は得られません。
検出がアクティブかどうかを示すフラグ。
- 発足
- 3.4
- (NSUInteger) deviceCount |
|
readnonatomicassign |
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-26 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-26 UTC。"],[[["\u003cp\u003eThe \u003ccode\u003eGCKDiscoveryManager\u003c/code\u003e class manages the discovery of Cast devices and maintains a list of discovered devices.\u003c/p\u003e\n"],["\u003cp\u003eIt automatically starts/suspends discovery when the app enters the foreground/background.\u003c/p\u003e\n"],["\u003cp\u003eApps can use this class directly to manage device discovery or rely on the framework's Cast dialog for device selection.\u003c/p\u003e\n"],["\u003cp\u003eListeners can be added to receive discovery notifications and be informed of changes in device availability.\u003c/p\u003e\n"],["\u003cp\u003eDiscovery can be customized using properties like \u003ccode\u003epassiveScan\u003c/code\u003e and \u003ccode\u003ediscoveryActive\u003c/code\u003e for resource management and scan behavior.\u003c/p\u003e\n"]]],["The `GCKDiscoveryManager` class manages device discovery by handling `GCKDeviceProvider` instances. It automatically starts discovery when the app is in the foreground and stops it in the background. Applications can manually start and stop discovery with `startDiscovery` and `stopDiscovery`. The manager maintains a list of discovered devices and notifies listeners added using `addListener`. Devices can be accessed by index via `deviceAtIndex:` or by unique ID with `deviceWithUniqueID:`. It can be determined whether discovery is active using `isDiscoveryActiveForDeviceCategory:`, `discoveryActive`, `passiveScan` or `hasDiscoveredDevices`.\n"],null,[]]