Posted by Luke Hopkins – Developer Relations Engineer
Today we are excited to announce that the Telecom Jetpack library is in alpha for developers who want or need to create voice and/or video calling applications. Our goal with this library is to simplify the developer integration process and improve VoIP calling on Android.
androidx.core:core-telecom:1.0.0-alpha02
It is in public alpha release
This release supports various telecom features including:
Platform synchronization
For places like clocks, this library allows the user to answer, reject, hang up, and hang up your call with a simple API, as well as display useful information like who the caller is.
This is also useful because if the device recognizes your call, you can allow the user to hold the current call if other calls arrive, such as a PTSN/SIM based call.
Sacred frontal support
With the change in Android 14, for applications to distinguish between front-end service types, this library meets the requirements for you. For more information, please see the Frontend Services documentation.
Frontend support allows users to stay connected to their calls even after the user moves away from your app… You don’t need to build your own frontend services or worry about the backend of your app.
Voice line
Instead of using an audio manager to track status, focus, and get a list of audio devices, this Telecom library lists your application’s endpoints for streaming audio to/from Bluetooth headsets, hearing aids, wired headsets, and other features. Giving users access and control over a wide range of hearing aids.
Backward compatibility
Backwards compatibility works on devices that support the telecom stack up to Android O (API level 26), which means implementing the simple API page below will support a variety of devices.
callsManager.addCall(
attributes,
onIsCallAnswered,
onIsCallDisconnected,
onIsCallActive,
onIsCallInactive
){
val callScope=this
}
You can also ask the package manager to find out if the device supports Telecom.
packagemanager.hasSystemFeature(PackageManager.FEATURE_TELECOM)
Why use this library with platform API
Similarly, you might be wondering why I’m moving to a new library when I can move deprecated APIs to new APIs added in Android 14.
New features
We will have more exciting additions coming to the Telecom library in the coming months, exclusive to the Jetpack library. These include expanded support for VoIP call actions, such as being able to mute the VoIP application locally and display the speaker’s name on another page, such as Android Auto. A new feature is coming soon that will allow users to transfer their continuous VoIP calls between their phones and tablets.
Backward compatibility
As mentioned earlier, this library supports backwards compatibility, which means that not only will your app be supported on different devices, but we can also solve compatibility issues with older Android versions.
With a simple API interface and great device coverage, this library is a goto solution for calling apps.
Migrating from Contact Services to CallsManager
Even if you have no connection service integration for your VoIP application, consider moving to CallsManager, as mentioned above we have many interesting features coming to this library and using the Jetpack library will give you a simple and complete solution moving forward. .
Migrating from ConnectionService to CallManager is fairly easy to implement, but it’s not a simple matter of changing the namespace. You can think of CallManager as representing the communication service and CallControlScope as representing the communication service.
Below shows the difference between how to change audio using Communication Service to CallControlScope.
You can also ask the package manager to find out if the device supports Telecom.
cconnectionService.setAudioRoute (int route)
when (requestEndpointChange(newEndpoint)) {
is CallControlResult.Success -> {
// Device changed
}
is CallControlResult.Error -> {
}
}
Another example of how simple this API is, you can add a call to a platform and define call attributes with the code below:
val attributes = CallAttributesCompat(
displayName = displayName,
address = address,
direction = CallAttributesCompat.DIRECTION_INCOMING,
callType = CallAttributesCompat.CALL_TYPE_AUDIO_CALL,
callCapabilities = (CallAttributesCompat.SUPPORTS_SET_INACTIVE
or CallAttributesCompat.SUPPORTS_STREAM
or CallAttributesCompat.SUPPORTS_TRANSFER),
)
callsManager.addCall(
attributes
) {
// Call control scope
}
From here you will have a call control scope and you can access the list of devices that can answer, hold, hang up and listen to this scope.
//call control scope
launch {
availableEndpoints.collect {
.....
}
}
getting started
To get started, head over to our updated developer guide and test out the public alpha release of the Telecom library. Be sure to check out our sample app on GitHub to show how to work with different APIs.
This sample application implements all the latest features of the Telecom library, showing how to:
- Voice line
- Front-end services
- Accept, hang up, reject and hold calls
- See integration
- Call style notification
Feedback
We’d love to hear from you during this alpha launch to help shape the library and influence its future roadmap.