Hide

CastDevice

public class CastDevice extends Object
implements Parcelable
java.lang.Object
   ↳ com.google.android.gms.cast.CastDevice

An object representing a Cast receiver device.

Constant Summary

int CAPABILITY_AUDIO_IN Audio-input device capability.
int CAPABILITY_AUDIO_OUT Audio-output device capability.
int CAPABILITY_VIDEO_IN Video-input device capability.
int CAPABILITY_VIDEO_OUT Video-output device capability.

Inherited Constant Summary

Field Summary

public static final Creator<CastDevice> CREATOR

Public Method Summary

int
boolean
equals(Object obj)
String
String
String
static CastDevice
WebImage
getIcon(int preferredWidth, int preferredHeight)
List<WebImage>
Inet4Address
String
int
boolean
hasCapabilities(int[] capabilities)
boolean
hasCapability(int capability)
boolean
int
boolean
boolean
isSameDevice(CastDevice castDevice)
void
String
void
writeToParcel(Parcel out, int flags)

Constants

public static final int CAPABILITY_AUDIO_IN

Audio-input device capability.

Constant Value: 8

public static final int CAPABILITY_AUDIO_OUT

Audio-output device capability.

Constant Value: 4

public static final int CAPABILITY_VIDEO_IN

Video-input device capability.

Constant Value: 2

public static final int CAPABILITY_VIDEO_OUT

Video-output device capability.

Constant Value: 1

Fields

public static final Creator<CastDevice> CREATOR

Public Methods

public int describeContents ()

public boolean equals (Object obj)

public String getDeviceId ()

Gets the unique ID for the device.

public String getDeviceVersion ()

Gets the device's version.

public String getFriendlyName ()

Gets the friendly name for the device.

public static CastDevice getFromBundle (Bundle extras)

Returns the CastDevice from extras, otherwise null.

public WebImage getIcon (int preferredWidth, int preferredHeight)

Returns a best-fit icon for the requested icon size.

public List<WebImage> getIcons ()

Returns a list of all of the device's icons. If there are no images, returns an empty list.

public Inet4Address getIpAddress ()

Gets the IPv4 address of the device.

public String getModelName ()

Gets the model name for the device.

public int getServicePort ()

Gets the device's service port.

public boolean hasCapabilities (int[] capabilities)

Tests if the device supports a given set of capabilities.

Parameters
capabilities The set capabilities for which to test. The expected value is one or more of the following constants: CAPABILITY_AUDIO_IN, CAPABILITY_AUDIO_OUT, CAPABILITY_VIDEO_IN, or CAPABILITY_VIDEO_OUT.

public boolean hasCapability (int capability)

Tests if the device supports a given capability.

Parameters
capability The capability to test for. The expected value is one of the following constants: CAPABILITY_AUDIO_IN, CAPABILITY_AUDIO_OUT, CAPABILITY_VIDEO_IN, or CAPABILITY_VIDEO_OUT.

public boolean hasIcons ()

Checks if the device has any icons.

public int hashCode ()

Overridden to return a hashcode of the device ID.

public boolean isOnLocalNetwork ()

Returns true if this CastDevice is on the local network.

public boolean isSameDevice (CastDevice castDevice)

Tests if this device refers to the same physical Cast device as castDevice. Two CastDevices are considered to refer to the same physical device if they have the same device ID.

Parameters
castDevice The CastDevice to test.
Returns
  • true if the device IDs are the same, else false.

public void putInBundle (Bundle bundle)

Writes the CastDevice to bundle.

public String toString ()

Returns a string representation of the device.

public void writeToParcel (Parcel out, int flags)