GCKOpenURLOptions Class
Stay organized with collections
Save and categorize content based on your preferences.
An object representing options that can be passed to a Cast-enabled application via a deep-link URL.
The source app encodes the Cast-specific options (including the unique ID of the device to cast to, and optionally the session ID of a specific Cast session to join) in a query parameter of the application URL using asURLQueryItem (GCKOpenURLOptions), and then opens the URL using UIApplication's -[openURL:options:completionHandler:]
method. The target app extracts the Cast-specific options from the URL it receives in its UIApplicationDelegate's -[application:openURL:options:]
method by calling openURLOptionsFromURL: (GCKOpenURLOptions). It then starts or joins a Cast session by passing these options to startSessionWithOpenURLOptions:sessionOptions: (GCKSessionManager).
- Since
- 4.0
Inherits NSObject, <NSCopying>, and <NSSecureCoding>.
Extracts the Cast-specific options from the specified URL.
- Returns
- The extracted options, or
nil
if the URL did not contain any Cast-specific options.
- (NSURLQueryItem *) asURLQueryItem |
|
|
|
Converts the options into a URL query item.
- Returns
- The options as an NSURLQueryItem.
- (NSString*) deviceUniqueID |
|
readwritenonatomiccopy |
The unique ID of the device to connect to.
Required.
- (NSString*) deviceFriendlyName |
|
readwritenonatomiccopy |
The friendly name of the device to connect to.
Optional. This value is not used by the GoogleCast framework, but may be of interest to the receiving application.
The session ID of the Cast session to join.
Optional. A value of nil
indicates that any currently active session should be joined, or if there is none, that a new one should be created.
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\u003e\u003ccode\u003eGCKOpenURLOptions\u003c/code\u003e enables deep-linking to Cast-enabled applications by encoding Cast-specific options within a URL.\u003c/p\u003e\n"],["\u003cp\u003eSource applications use \u003ccode\u003easURLQueryItem\u003c/code\u003e to create the URL and \u003ccode\u003eopenURL:options:completionHandler:\u003c/code\u003e to open it, while target applications use \u003ccode\u003eopenURLOptionsFromURL:\u003c/code\u003e to extract the options.\u003c/p\u003e\n"],["\u003cp\u003eKey options include \u003ccode\u003edeviceUniqueID\u003c/code\u003e (required), \u003ccode\u003edeviceFriendlyName\u003c/code\u003e (optional), and \u003ccode\u003esessionID\u003c/code\u003e (optional for joining existing or starting new sessions).\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can utilize these options with \u003ccode\u003estartSessionWithOpenURLOptions:sessionOptions:\u003c/code\u003e to initiate or join Cast sessions seamlessly.\u003c/p\u003e\n"]]],["The GCKOpenURLOptions class manages options for Cast-enabled apps via deep-link URLs. Source apps encode Cast options (device ID, optional session ID) into a URL query item using `asURLQueryItem`. The receiving app extracts these options using `openURLOptionsFromURL:`. This class enables the receiver to start or join a Cast session by providing these options to `startSessionWithOpenURLOptions:sessionOptions:`. Key properties include `deviceUniqueID`, `deviceFriendlyName`, and `sessionID`, enabling connection to a specific device or session.\n"],null,["# GCKOpenURLOptions Class\n\n[Instance Methods](#pub-methods) \\| [Class Methods](#pub-static-methods) \\| [Properties](#properties) \nGCKOpenURLOptions Class Reference \n\nOverview\n--------\n\nAn object representing options that can be passed to a Cast-enabled application via a deep-link URL.\n\nThe source app encodes the Cast-specific options (including the unique ID of the device to cast to, and optionally the session ID of a specific Cast session to join) in a query parameter of the application URL using [asURLQueryItem (GCKOpenURLOptions)](/cast/docs/reference/ios/interface_g_c_k_open_u_r_l_options#aed1ec924900e9ce476887abf06cfc588 \"Converts the options into a URL query item. \"), and then opens the URL using UIApplication's `-[openURL:options:completionHandler:]` method. The target app extracts the Cast-specific options from the URL it receives in its UIApplicationDelegate's `-[application:openURL:options:]` method by calling [openURLOptionsFromURL: (GCKOpenURLOptions)](/cast/docs/reference/ios/interface_g_c_k_open_u_r_l_options#af755ffd517e47ae816884a564245103a \"Extracts the Cast-specific options from the specified URL. \"). It then starts or joins a Cast session by passing these options to [startSessionWithOpenURLOptions:sessionOptions: (GCKSessionManager)](/cast/docs/reference/ios/interface_g_c_k_session_manager#a77bf30ff4579f7c101815d2b2250dc12 \"Attempts to join or start a session with options that were supplied to the UIApplicationDelegate::app...\").\n\nSince\n: 4.0\n\nInherits NSObject, \\\u003cNSCopying\\\u003e, and \\\u003cNSSecureCoding\\\u003e.\n\n|---------------------|-------------------------------------------------------------------------------------------------------------------|\n| Instance Method Summary ----------------------- ||\n| (NSURLQueryItem \\*) | - [asURLQueryItem](/cast/docs/reference/ios/interface_g_c_k_open_u_r_l_options#aed1ec924900e9ce476887abf06cfc588) |\n| | Converts the options into a URL query item. [More...](#aed1ec924900e9ce476887abf06cfc588) |\n| ||\n\n|------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|\n| Class Method Summary -------------------- ||\n| (nullable [GCKOpenURLOptions](/cast/docs/reference/ios/interface_g_c_k_open_u_r_l_options) \\*) | + [openURLOptionsFromURL:](/cast/docs/reference/ios/interface_g_c_k_open_u_r_l_options#af755ffd517e47ae816884a564245103a) |\n| | Extracts the Cast-specific options from the specified URL. [More...](#af755ffd517e47ae816884a564245103a) |\n| ||\n\n|-------------|---------------------------------------------------------------------------------------------------------------------|\n| Property Summary ---------------- ||\n| NSString \\* | [deviceUniqueID](/cast/docs/reference/ios/interface_g_c_k_open_u_r_l_options#a668da1e22bb4f6cc5920525f03d0ff79) |\n| | The unique ID of the device to connect to. [More...](#a668da1e22bb4f6cc5920525f03d0ff79) |\n| ||\n| NSString \\* | [deviceFriendlyName](/cast/docs/reference/ios/interface_g_c_k_open_u_r_l_options#a54a1b390b84b29d13798270382ccb3cb) |\n| | The friendly name of the device to connect to. [More...](#a54a1b390b84b29d13798270382ccb3cb) |\n| ||\n| NSString \\* | [sessionID](/cast/docs/reference/ios/interface_g_c_k_open_u_r_l_options#ab797a623e3efe345d25caa3e83046822) |\n| | The session ID of the Cast session to join. [More...](#ab797a623e3efe345d25caa3e83046822) |\n| ||\n\nMethod Detail\n-------------\n\n|-------------------------------------------------------------------------------------------------------------------------|---|------------|-------|---|\n| + (nullable [GCKOpenURLOptions](/cast/docs/reference/ios/interface_g_c_k_open_u_r_l_options) \\*) openURLOptionsFromURL: | | (NSURL \\*) | *url* | |\n\nExtracts the Cast-specific options from the specified URL.\n\nReturns\n: The extracted options, or `nil` if the URL did not contain any Cast-specific options. \n\n|--------------------------------------|---|---|---|\n| - (NSURLQueryItem \\*) asURLQueryItem | | | |\n\nConverts the options into a URL query item.\n\nReturns\n: The options as an NSURLQueryItem.\n\nProperty Detail\n---------------\n\n|---------------------------------------------------------------------|------------------------|\n| |-------------------------------| | - (NSString\\*) deviceUniqueID | | readwritenonatomiccopy |\n\nThe unique ID of the device to connect to.\n\nRequired. \n\n|-----------------------------------------------------------------------------|------------------------|\n| |-----------------------------------| | - (NSString\\*) deviceFriendlyName | | readwritenonatomiccopy |\n\nThe friendly name of the device to connect to.\n\nOptional. This value is not used by the GoogleCast framework, but may be of interest to the receiving application. \n\n|-----------------------------------------------------------|------------------------|\n| |--------------------------| | - (NSString\\*) sessionID | | readwritenonatomiccopy |\n\nThe session ID of the Cast session to join.\n\nOptional. A value of `nil` indicates that any currently active session should be joined, or if there is none, that a new one should be created."]]