A Web Receiver device (such as a Chromecast) in guest mode allows a sender device (a phone or tablet) to cast to it when that sender device is nearby, without requiring that the sender be connected to the same WiFi network as the Web Receiver device.
When a sender device is near a Web Receiver in guest mode, a route called "Nearby device" appears in the sender app's Cast menu for that Web Receiver. To authenticate, the sender listens for a token from the Web Receiver using ultrasonic audio. If this automatic authentication fails, the user is prompted to manually enter the guest mode PIN. Users can find the PIN on the Chromecast backdrop or in the device settings in the Google Home app.
iOS guest mode
iOS 13 permission changes
With iOS 13, Apple has introduced stricter permissions requirements which impact apps using the Google Cast SDK.
You need to add the Privacy - Bluetooth Always Usage Description
permission
to your app's Info.plist
file, as follows. Replace ${PRODUCT_NAME}
with the name of your app; the description should be changed if your app uses
Bluetooth® for other reasons in addition to cast.
<key>NSBluetoothAlwaysUsageDescription</key> <string>${PRODUCT_NAME} uses Bluetooth to discover nearby Cast devices.</string>
Starting with Google Cast SDK v4.4.3, an additional SDK is available without
guest mode support that does not require the Bluetooth®
permission. This is available both on the
developer site and on the new
google-cast-sdk-no-bluetooth
CocoaPods.
Removing guest mode for iOS
Starting with Google Cast SDK v4.4.3, an additional SDK is available without
guest mode support that does not require the Bluetooth® permission. This is
available both on the developer site
and on the new google-cast-sdk-no-bluetooth
CocoaPods.
iOS Bluetooth® and microphone permissions
iOS uses Bluetooth to scan for nearby devices and so requires permission to use Bluetooth in guest mode. The microphone is needed to listen for the ultrasonic token when pairing with a guest mode device and also requires permission.
For proper permissions, you need to add two entries to your app's Info.plist
file, as follows. Replace ${PRODUCT_NAME}
with the name of your app; the
description should be changed if your app uses these permissions for other
reasons in addition to cast.
<key>NSBluetoothPeripheralUsageDescription</key> <string>${PRODUCT_NAME} uses Bluetooth to discover nearby Cast devices.</string> <key>NSMicrophoneUsageDescription</key> <string>${PRODUCT_NAME} uses microphone access to listen for ultrasonic tokens when pairing with nearby Cast devices.</string>
These entries have been required since iOS 10.
Supported Cast devices
iOS senders - Guest mode for iOS uses Bluetooth Low Energy (BLE) and audio tokens to identify nearby Chromecast devices. BLE support was added to new generation Chromecast and Chromecast Audio devices (which have a round shape and were launched September 2015). Thus, guest mode works on this new generation of devices. Guest mode with iOS sender devices does not work on older generation Chromecast devices.
Android senders - Guest mode for Android uses WiFi to identify nearby Chromecast devices. On Android, guest mode is supported on all Chromecast and Chromecast Audio devices (including the older generation).
Nexus Player and Android TV do not support guest mode.
Developer considerations
The PIN code handshake required to initiate a session happens automatically, but there may be circumstances that prevent the exchange from completing. For example, the TV may be muted, or there may be other interference.
The Google Cast SDK supports guest mode automatically: your app displays the Cast button if the Cast SDK finds a Web Receiver either in guest mode or connected to the same WiFi network as the sender. Your app supports guest mode as long as it does not explicitly check for or require a WiFi connection to do Cast discovery and show the Cast button.
Guest mode uses a cloud-based relay to signal from the sender to the Web Receiver instead of the local WiFi. Consequently, the following functionality is not supported in guest mode:
- Chrome tab mirroring, Android mirroring
- Casting locally stored media (such as photos, video, or audio)
Disabling guest mode
When you disable guest mode, your app cannot connect to nearby Web Receivers in guest mode, but your app can connect normally to those Web Receivers on the same WiFi network as the sender device running your app.
Mirroring or casting locally stored media
If your app depends on mirroring or casting locally stored media, you must disable guest mode. See Edit application information for the steps to disable guest mode.
Android apps
For Android apps, if you have cases where only certain features require local
network access and these do not work with guest mode connections, you can use
the isOnLocalNetwork()
property of the Cast Device
object in the latest Google Play Services SDK Client Library.