public interface SinchClient
It provides access to the feature classes in the Sinch SDK: CallClient, AudioController and VideoController. It is also used to configure the user's and device's capabilities.
The user IDs that are used to identify users application specific. If the app already has a scheme for user IDs (email addresses, phone numbers, customer numbers, etc.), the same ID could be used when configuring the SinchClient.
// Instantiate a SinchClient
android.content.Context context = this.getApplicationContext();
SinchClient sinchClient = Sinch.getSinchClientBuilder().context(context)
.applicationKey("<application-key>")
.environmentHost("ocra.api.sinch.com")
.userId("<user id>")
.build();
// Specify the client capabilities.
((SinchClientPrivate)sinchClient).setSupportActiveConnection(true);
sinchClient.setSupportManagedPush(true);
// Add the client listener that handles client state changes.
sinchClient.addSinchClientListener(...);
// Start the client
sinchClient.start();
...
// Use the CallClient to place and receive calls
// Stop listening for incoming calls.
sinchClient.stopListeningOnActiveConnection();
// Stop the client when the calling functionality is no longer needed.
sinchClient.terminateGracefully();
Modifier and Type | Method and Description |
---|---|
void |
addSinchClientListener(SinchClientListener sinchClientListener)
The
SinchClientListener object handles events from the
SinchClient such as incoming calls. |
void |
checkManifest()
This method should be called before
start() and be used during
development time to verify that the manifest contains the permissions
required. |
AudioController |
getAudioController()
Returns an
AudioController object for controlling different audio
settings. |
CallClient |
getCallClient()
Returns the
CallClient object for placing and receiving calls. |
java.lang.String |
getLocalUserId()
Returns the id of the user associated with this
SinchClient . |
VideoController |
getVideoController()
Returns a
VideoController object for managing and retrieving views for Video calls. |
boolean |
isStarted()
Returns
true if the SinchClient is started. |
NotificationResult |
relayRemotePushNotificationPayload(android.content.Intent intent)
Method used to forward the intent received from FCM.
|
NotificationResult |
relayRemotePushNotificationPayload(java.util.Map<java.lang.String,java.lang.String> payload)
Method used to forward the intent received from FCM.
|
NotificationResult |
relayRemotePushNotificationPayload(java.lang.String payload)
Method used to forward the Sinch specific payload extracted from an
incoming Google Cloud Messaging message.
|
void |
removeSinchClientListener(SinchClientListener sinchClientListener)
Remove listener for client events.
|
void |
setMediaHandover(boolean enable)
Enables and disables media handover functionality.
|
void |
setPushNotificationDisplayName(java.lang.String displayName)
Specify a display name to be used when the Sinch client sends a push notification on
behalf of the local user (e.g.
|
void |
setSupportManagedPush(boolean enabled)
Enables the use of managed push, where Sinch is responsible for sending your app a push notification when
necessary.
|
void |
start()
Starts the Sinch client.
|
void |
startListeningOnActiveConnection()
Start listening for incoming calls.
|
void |
stopListeningOnActiveConnection()
Stop listening for incoming calls.
|
void |
terminateGracefully()
Terminates the Sinch client, while still leaving it some time to finish up currently
pending tasks, for example finishing pending HTTP requests.
|
void setSupportManagedPush(boolean enabled)
enabled
- whether or not managed push is enabledvoid checkManifest()
start()
and be used during
development time to verify that the manifest contains the permissions
required. Once the application is ready to be published any calls to this
manifest can be removed.MissingPermissionException
- if any of the required permissions are
missing.CallClient getCallClient()
CallClient
object for placing and receiving calls.CallClient
object.java.lang.IllegalStateException
- if disposed.void addSinchClientListener(SinchClientListener sinchClientListener)
SinchClientListener
object handles events from the
SinchClient
such as incoming calls.sinchClientListener
- a SinchClientListener
void removeSinchClientListener(SinchClientListener sinchClientListener)
sinchClientListener
- a SinchClientListener
void start()
startListening
.java.lang.IllegalStateException
- if SinchClient
is already startedMissingPermissionException
- if SinchClient
detects that the app lacks
required
Android permissionsboolean isStarted()
true
if the SinchClient
is started.true
if the SinchClient
is started.void terminateGracefully()
void startListeningOnActiveConnection()
void stopListeningOnActiveConnection()
NotificationResult relayRemotePushNotificationPayload(java.lang.String payload)
SinchClient
if it wasn't already started.payload
- Sinch specific payload which was transferred with the messageNotificationResult relayRemotePushNotificationPayload(android.content.Intent intent)
SinchClient
if it wasn't already started.intent
- Intent received from a FCM receiverSinchHelpers.isSinchPushIntent(Intent)
,
relayRemotePushNotificationPayload(String)
NotificationResult relayRemotePushNotificationPayload(java.util.Map<java.lang.String,java.lang.String> payload)
SinchClient
if it wasn't already started.payload
- Payload received from a FCM RemoteMessage dataSinchHelpers.isSinchPushPayload(java.util.Map)
,
relayRemotePushNotificationPayload(String)
void setPushNotificationDisplayName(java.lang.String displayName)
setSupportManagedPush(boolean)
).
Display name is included in a push notification on a best-effort basis. For example, if the
target device has very limited push payload size constraints (e.g iOS 7 can only handle
255 byte push notification payload), then the display name may not be included.displayName
- display name may at most be 255 bytes (UTF-8 encoded) long.void setMediaHandover(boolean enable)
enable
- equal to false disables media handover from WiFi to cellular when WiFi is lost.java.lang.String getLocalUserId()
SinchClient
.AudioController getAudioController()
AudioController
object for controlling different audio
settings. You may only call this method while the SinchClient
is
started.AudioController
object for controlling audio settings.java.lang.IllegalStateException
- if SinchClient
isn't started.VideoController getVideoController()
VideoController
object for managing and retrieving views for Video calls.VideoController
object for controlling video settings.Copyright 2016, Sinch AB