The singleton class as the entry point of the Cast TV SDK.
Nested Class Summary
Public Method Summary
static CastReceiverContext | |
MediaManager | |
CastReceiverOptions | |
SenderInfo | |
Collection < SenderInfo > | |
static void | |
void | registerEventCallback
( CastReceiverContext.EventCallback
callback)
Registers a
CastReceiverContext.EventCallback
|
void | |
void | sendMessage
( String
namespace, String
senderId, String
message)
Sends a message to a specific sender.
|
void | setMessageReceivedListener
( String
namespace, CastReceiverContext.MessageReceivedListener
listener)
Sets a listener for a given namespace.
|
void | |
void | |
void | unregisterEventCallback
( CastReceiverContext.EventCallback
callback)
Unregisters a
CastReceiverContext.EventCallback
|
Inherited Method Summary
Public Methods
public static CastReceiverContext getInstance ()
Returns the shared instance. Returns null
if the instance hasn't been
initialized.
public MediaManager getMediaManager ()
Returns the MediaManager
.
public CastReceiverOptions getReceiverOptions ()
Returns the receiver options.
public SenderInfo getSender ( String senderId)
Returns the SenderInfo
with the given senderId
. Returns null
if not found.
public Collection < SenderInfo > getSenders ()
Returns all senders.
public static void initInstance ( Context context)
Initializes the shared instance.
public void registerEventCallback ( CastReceiverContext.EventCallback callback)
Registers a CastReceiverContext.EventCallback
public void removeMessageReceivedListener ( String namespace)
Removes a listener for a given namespace.
public void sendMessage ( String namespace, String senderId, String message)
Sends a message to a specific sender.
Parameters
namespace | the namespace. Note that a valid namespace has to be prefixed with the string 'urn:x-cast:' |
---|---|
senderId | the sender Id, or null
for broadcast to all senders |
message | the message |
public void setMessageReceivedListener ( String namespace, CastReceiverContext.MessageReceivedListener listener)
Sets a listener for a given namespace.
Will replace a listener for the namespace if there is one.
public void start ()
Tells the Cast TV SDK that the receiver app has started and is ready to accept commands.
The MediaCommandCallback
and CastReceiverContext.MessageReceivedListener
will be invoked if new messages
arrive.
public void stop ()
Tells the Cast TV SDK that the receiver app has stopped and won't accept commands any more.
The MediaCommandCallback
and CastReceiverContext.MessageReceivedListener
will no longer be invoked.
public void unregisterEventCallback ( CastReceiverContext.EventCallback callback)
Unregisters a CastReceiverContext.EventCallback