com.twilio.clientThe DeviceListener interface defines a set of callbacks for events related to a Device instance.
| Name | Description | Type |
|---|---|---|
| onStartListening | Called when the Device has started listening for incoming connections. | Instance method |
| onStopListening | Called when the Device has stopped listening for incoming connections. | Instance method |
| onStopListening | Called when the Device has stopped listening for incoming connections due to an error condition. | Instance method |
| receivePresenceEvents | Called to query whether or not the application wants to receive presence events. | Instance method |
| onPresenceChanged | Called when the presence status for one or more other clients has changed. | Instance method |
void onStartListening(Device inDevice)Called when the Device has started listening for incoming connections.
| Name | Description |
|---|---|
inDevice |
The Device instance that has started listening |
None
void onStopListening(Device inDevice)Called when the Device has stopped listening for incoming connections.
| Name | Description |
|---|---|
inDevice |
The device instance that has stopped listening |
None
void onStopListening(Device inDevice, int inErrorCode, String inErrorMessage)Called when the Device has stopped listening for incoming connections due to an error condition.
For a list of error codes and their meanings, see http://www.twilio.com/docs/client/errors.
| Name | Description |
|---|---|
inDevice |
The device instance that has stopped listening |
inErrorCode |
The error code that pinpoints the error |
inErrorMessage |
A string describing the error in a human-readable form |
None
boolean receivePresenceEvents(Device inDevice)Called to query whether or not the application wants to receive presence events.
Since bandwidth and battery life can both be precious resources on a mobile
device, you may not want to incur the extra overhead of receiving and processing
presence notifications. If not, simply implement this method and return false
from it. You'll still need to implement
DeviceListener.onPresenceChanged(), of course, but
an empty body will do, and it will never be called.
| Name | Description |
|---|---|
inDevice |
The Device querying about presence notifications |
Whether or not the application wants to receive presence events
void onPresenceChanged(Device inDevice, PresenceEvent inPresenceEvent)Called when the presence status for one or more other clients has changed.
When the device is ready, this method is invoked once for each available client if
.receivePresenceEvents() returns true.
Thereafter it is invoked as clients become available or unavailable.
A client is considered available even if another call is in progress.
When your client disconnects the DeviceListener.onStopListening()
method will be invoked, and when the device reconnects this method will be called again
for every available online client.
The PresenceEvent object may be reused in between calls, so any
data required to persist past the invocation of this method should be copied out.
| Name | Description |
|---|---|
inDevice |
The Device receiving the presence change notification |
inPresenceEvent |
A PresenceEvent object describing the notification |
None