A 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 receiver device.
When a sender device is near a receiver in guest mode, a route called “Nearby device” appears in the sender app's Cast menu for that receiver. To authenticate, the sender listens for a token from the 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 Chromecast app.
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 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 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
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.
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 CastDevice object in the latest Google Play Services SDK Client library.
When you disable guest mode, your app cannot connect to nearby receivers in guest mode, but your app can connect normally to those receivers on the same WiFi network as the sender device running your app.