Package com.tomtom.ivi.platform.telecom.api.service.telecommanagement
The telecom management service API package.
Telecom management service
The telecom management service is an IVI service. The TelecomManagementService is used by the IviInCallService to notify the TelecomService of call state changes. This is because the IviInCallService that is used to get the call states from Android needs to be a subclass of the Android InCallService and can therefore not also be an IVI service.
Overview of the telecom management service
The TelecomManagementService is a layer between the TelecomService, which communicates with the frontends, and the IviInCallService, which is a system service that is bound by the Android TelecomManager and receives state information about incoming and outgoing calls for all registered ConnectionServices.
.
The telecom management service API documentation
The telecom management service provides the following functionality:
#using-telecom-management-service-api.
#on-call-changed.
#on-call-removed.
#on-muted-changed.
#management-listener.
Using telecom management service API
To use the telecom management service, add a dependency to the TelecomManagementService to your gradle file:
dependencies {
implementation("com.tomtom.ivi.platform:platform_telecom_api_service_telecommanagement")
}
To get access to the TelecomManagementService API, you need to first get a TelecomManagementServiceApi
instance by calling the companion function TelecommanagementService.createApi(...)
.
val telecomManagementService = TelecommanagementService.createApi(lifecycleOwner, iviServiceProvider)
Once you have a TelecomManagementServiceApi
instance, you can use it to call any API, and observe any property provided by the service.
Note: The service may not be ready when a client calls the service API and could return a SERVICE_UNAVAILABLE
result. It is possible to check the service availability by observing the serviceAvailable
property:
telecomManagementService.serviceAvailable.observe(lifecycleOwner) {
if (it) {
// Service is available
} else {
// Service is not available
}
}
On call changed
When a call state changes, the (IvI)InCallService calls onCallChangedAsync
(asynchronous) or coOnCallChanged
(synchronous) function with the specified Call
. In the following example, a new Call
is detected asynchronously:
telecomManagementService.queueOrRun { it.onCallChangedAsync(call) }
Note: Clients (frontends) should not call those APIs and they should only rely on the TelecomService API.
On call removed
To indicate that a Call
was removed, call the onCallRemovedAsync
(asynchronous) or coOnCallRemoved
(synchronous) function with the specified CallId
. A CallId
is provided for each call in the calls
list property. In the following example, the removal of a Call
is detected asynchronously:
telecomManagementService.queueOrRun { it.onCallRemovedAsync(call.id) }
On muted changed
To indicate that the muting state of a Call
has changed, call the onMutedChangedAsync
(asynchronous) or coOnMutedChanged
(synchronous) functions with the correct value for isMuted
.
In the following example, the isMuted
state has changed to muted asynchronously:
telecomManagementService.queueOrRun { it.onMutedChangedAsync(true) }
Management listener
This is a listener that is registered by the telecom management service so it can receive the following requests:
Answer a call.
Reject a call.
End a call.
Set a call on hold.
Play a DTMF tone on a call.
Mute/unmute the microphone.
See TelecomManagementService.ManagementListener.