GCKDiscoveryManager Class
Stay organized with collections
Save and categorize content based on your preferences.
A class that manages the device discovery process.
GCKDiscoveryManager
manages a collection of GCKDeviceProvider
subclass instances, each of which is responsible for discovering devices of a specific type. It also maintains a lexicographically ordered list of the currently discovered devices.
The framework automatically starts the discovery process when the application moves to the foreground and suspends it when the application moves to the background. It is generally not necessary for the application to call startDiscovery (GCKDiscoveryManager)
and stopDiscovery (GCKDiscoveryManager)
, except as an optimization measure to reduce network traffic and CPU utilization in areas of the application that do not use Casting functionality.
If the application is using the framework's Cast dialog, either by way of GCKUICastButton
or by presenting it directly, then that dialog will use GCKDiscoveryManager
to populate its list of available devices. If however the application is providing its own device selection/control dialog UI, then it should use the GCKDiscoveryManager
and its associated listener protocol, GCKDiscoveryManagerListener
, to populate and update its list of available devices.
- Since
- 3.0
Inherits NSObject.
Default initializer is not available. More...
Adds a listener that will receive discovery notifications. More...
Removes a previously registered listener. More...
Starts the discovery process. More...
Stops the discovery process. More...
Tests whether discovery is currently active for the given device category. More...
Returns the device at the given index in the manager's list of discovered devices. More...
Returns the device with the given unique ID in the manager's list of discovered devices. More...
The current discovery state. More...
A flag indicating whether any devices have been discovered by any of the discovery providers managed by this object. More...
A flag indicating whether discovery should employ a "passive" scan. More...
A flag indicating whether discovery is active or not. More...
The number of devices that are currently discovered. More...
Default initializer is not available.
Adds a listener that will receive discovery notifications.
- Parameters
-
listener
The listener to add.
Removes a previously registered listener.
- Parameters
-
listener
The listener to remove.
Starts the discovery process.
Stops the discovery process.
- (BOOL) isDiscoveryActiveForDeviceCategory: |
|
(NSString *) |
deviceCategory
|
|
Tests whether discovery is currently active for the given device category.
- ( GCKDevice
*) deviceAtIndex: |
|
(NSUInteger) |
index
|
|
Returns the device at the given index in the manager's list of discovered devices.
- ( GCKDevice
*__nullable) deviceWithUniqueID: |
|
(NSString *) |
uniqueID
|
|
Returns the device with the given unique ID in the manager's list of discovered devices.
- Parameters
-
uniqueID
The device's unique ID.
- Returns
- The matching GCKDevice
object, or
nil
if a matching device was not found.
- (GCKDiscoveryState) discoveryState
read
nonatomic
assign
The current discovery state.
- (BOOL) hasDiscoveredDevices
read
nonatomic
assign
A flag indicating whether any devices have been discovered by any of the discovery providers managed by this object.
read
write
nonatomic
assign
A flag indicating whether discovery should employ a "passive" scan.
Passive scans are less resource-intensive but do not provide results that are as fresh as active scans.
A flag indicating whether discovery is active or not.
- Since
- 3.4
- (NSUInteger) deviceCount
read
nonatomic
assign
The number of devices that are currently discovered.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 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,[]]