public abstract class Voice extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Voice.RegistrationChannel |
Modifier and Type | Method and Description |
---|---|
static Call |
connect(android.content.Context context,
ConnectOptions connectOptions,
Call.Listener listener)
Creates a new
Call . |
static Call |
connect(android.content.Context context,
String accessToken,
Call.Listener listener)
Creates a new
Call . |
static LogLevel |
getLogLevel()
Returns the logging level for messages logged by the Voice SDK.
|
static LogLevel |
getModuleLogLevel(LogModule module)
Returns the logging level for messages logged by the specified LogModule.
|
static String |
getVersion()
Returns the version of the Voice SDK.
|
static boolean |
handleMessage(android.content.Context context,
android.os.Bundle data,
MessageListener listener)
Handle messages from GCM
|
static boolean |
handleMessage(android.content.Context context,
Map<String,String> data,
MessageListener listener)
Handle messages from FCM.
|
static void |
register(String accessToken,
Voice.RegistrationChannel registrationChannel,
String registrationToken,
RegistrationListener listener)
Register for incoming call messages.
|
static void |
setLogLevel(LogLevel level)
Sets the logging level for messages logged by the Voice SDK.
|
static void |
setModuleLogLevel(LogModule module,
LogLevel level)
Sets the logging level for messages logged by a specific module.
|
static void |
unregister(String accessToken,
Voice.RegistrationChannel registrationChannel,
String registrationToken,
UnregistrationListener listener)
Unregisters from receiving further incoming call messages.
|
public static void register(String accessToken, Voice.RegistrationChannel registrationChannel, String registrationToken, RegistrationListener listener)
accessToken
- An access token.registrationChannel
- An enumeration of registration channels.registrationToken
- A GCM or FCM registration token.listener
- A listener that receives registration request status.public static void unregister(String accessToken, Voice.RegistrationChannel registrationChannel, String registrationToken, UnregistrationListener listener)
accessToken
- An access token.registrationChannel
- An enumeration of registration channels.registrationToken
- An FCM or GCM device token.listener
- A listener that receives unregistration request status.public static Call connect(android.content.Context context, ConnectOptions connectOptions, Call.Listener listener)
Call
.
A SecurityException
will be thrown if RECORD_AUDIO is not granted
context
- An Android context.connectOptions
- A set of options that allow you to configure your Call
.listener
- A listener that receives call status.Call object
public static Call connect(android.content.Context context, String accessToken, Call.Listener listener)
Call
.
A SecurityException
will be thrown if RECORD_AUDIO is not granted
context
- An Android context.accessToken
- The accessToken that provides the identity and grants of the caller.listener
- A listener that receives call status.Call object
public static boolean handleMessage(android.content.Context context, Map<String,String> data, MessageListener listener)
Twilio sends two types of notifications messages via GCM/FCM, `call` and `cancel` messages. The message type is encoded in the dictionary with the key `twi_message_type` and the values `twilio.voice.call` and `twilio.voice.cancel`.
A `call` message is sent when someone wants to reach the registered `identity`.
Passing a `call` message into handleMessage(Context, Map, MessageListener)
will result in a CallInvite
raised in the MessageListener
and return `true`.
A `cancel` message is sent when a call made to this `identity` is prematurely `disconnected` by the caller, when the call is `rejected`, when the call is `ignored`, or when the call is `accepted` due to an outstanding infrastructure issue.
Passing a `cancel` message into handleMessage(Context, Map, MessageListener)
will result in a CancelledCallInvite
raised in the MessageListener
and return `true`.
Providing malformed data to handleMessage(Context, Map, MessageListener)
will return `false`.
public static boolean handleMessage(android.content.Context context, android.os.Bundle data, MessageListener listener)
Twilio sends 2 types of notifications messages via GCM/FCM, `call` and `cancel` messages. The message type is encoded in the dictionary with the key `twi_message_type` and the values `twilio.voice.call` and `twilio.voice.cancel`.
A `call` message is sent when someone wants to reach the registered `identity`.
Passing a `call` message into handleMessage(Context, Map, MessageListener)
will result in a CallInvite
raised in the MessageListener
and return `true`.
A `cancel` message is sent when a call made to this `identity` is prematurely `disconnected` by the caller, when the call is `rejected`, when the call is `ignored`, or when the call is `accepted` due to an outstanding infrastructure issue.
Passing a `cancel` message into handleMessage(Context, Map, MessageListener)
will result in a CancelledCallInvite
raised in the MessageListener
and return `true`.
Providing a message that is malformed into handleMessage(Context, Map, MessageListener)
will return `false`.
public static String getVersion()
public static LogLevel getLogLevel()
LogLevel.ERROR
.public static LogLevel getModuleLogLevel(LogModule module)
LogLevel.ERROR
.public static void setLogLevel(LogLevel level)
level
- The logging level3.0.0-beta3