[ad_1]
Posted by Luke Hopkins – Developer Relations Engineer
At present we’re thrilled to announce that the Telecom jetpack library is now in alpha for builders who have already got or are occupied with creating voice and/or video calling purposes. Our intention with this library is to simplify the developer integration course of and enhance VoIP calling throughout Android surfaces.
androidx.core:core-telecom:1.0.0-alpha02
What’s within the Public Alpha launch
This launch helps quite a lot of Telecom options, together with:
Platform synchronization
For surfaces like watches, this library permits the person to reply, decline, dangle up and mute your name by a easy API, in addition to displaying helpful info similar to who the caller is.
That is additionally useful as a result of if the machine is conscious of your name, ought to different calls such a PTSN/SIM based mostly name come by, you can provide the person an opportunity to carry the decision they’re at the moment on.
Devoted foreground help
With the adjustments to Android 14, which require purposes to specify foreground service sorts, this library takes care of the necessities for you. For extra info, please confer with the foreground service documentation.
Foreground help permits customers to remain linked to their calls even after the person has navigated away out of your app… You received’t have to construct your personal foreground companies or fear in regards to the background state of your utility.
Audio Routing
As a substitute of utilizing the audio supervisor to trace state, focus and procure a listing of audio gadgets, this Telecom library will record all accessible endpoints to your utility for streaming audio to/from Bluetooth hearables, listening to aids, wired headphones, and different surfaces, thus giving customers entry and management to a variety of hearable gadgets.
Backwards Compatibility
Backwards compatibility works all the way in which all the way down to Android O (API Degree 26) on gadgets which help the Telecom stack which suggests implementing the straightforward API floor beneath helps a variety of gadgets.
callsManager.addCall(
attributes,
onIsCallAnswered,
onIsCallDisconnected,
onIsCallActive,
onIsCallInactive
){
val callScope=this
}
You can too question the packagemanager to know if the machine helps Telecom.
packagemanager.hasSystemFeature(PackageManager.FEATURE_TELECOM)
Why use this library over Platform API
You may be pondering, why make this transfer to a brand new library once I might simply equally migrate the deprecated APIs to the brand new APIs added in Android 14. Effectively this library gives:
New Options
We can have extra thrilling additions coming to the Telecom library within the coming months that are unique to the jetpack library. These included expanded help for VoIP Name actions similar to having the ability to regionally mute the VoIP app for the precise name and having the ability to show the title of the speaker on one other floor similar to Android Auto. We even have a brand new characteristic coming quickly that can permit customers to switch their ongoing VoIP calls between their telephones and tablets.
Backward Compatibility
As beforehand acknowledged, this library helps backward compatibility, which signifies that your app is not going to solely be supported on a wider vary of gadgets, however we will resolve interoperability points with older Android variations.
A easy API floor and a big protection of gadgets, means this library is the goto answer for calling purposes.
Migrating from ConnectionService to CallsManager
Even when you have already got an present ConnectionService integration on your VoIP app, it is best to contemplate migrating to CallsManager, as talked about above we’ve loads of thrilling options coming to this library and utilizing the jetpack library provides you with a easy and full answer transferring ahead.
Migrating from ConnectionService to CallManager is pretty simple to implement however shouldn’t be a easy case of adjusting namespace. You’ll be able to consider CallManager representing ConnectionService and CallControlScope representing ConnectionService.
Under reveals the distinction between how one can swap audio utilizing connection service to CallControlScope.
You can too question the packagemanager to know if the machine helps Telecom.
cconnectionService.setAudioRoute (int route)
when (requestEndpointChange(newEndpoint)) {
is CallControlResult.Success -> {
// Machine modified
}
is CallControlResult.Error -> {
}
}
One other instance displaying how easy this API is to make use of, you possibly can add a name to the platform and outline you name attributes with the code beneath:
val attributes = CallAttributesCompat(
displayName = displayName,
deal with = deal with,
route = 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
) {
// Name management scope
}
From right here you’ll have a name management scope and this scope you possibly can reply, maintain, disconnect and get a listing of hearable gadgets.
//name management scope
launch {
availableEndpoints.gather {
.....
}
}
Getting began
Head over to our up to date developer information to get began and check out the Public Alpha launch of the Telecom library. Be sure to take a look at our pattern app discovered on GitHub for an indication on how one can work with the varied APIs.
This pattern utility implements all the newest options for the Telecom library displaying how one can do:
- Audio Routing
- Foreground Companies
- Settle for, Disconnect, Reject and Maintain calls
- Watch integration
- CallStyle notification
Suggestions
We’d love to listen to from you throughout this Alpha launch to assist us form the library and affect future roadmapping, so please share your suggestions and tell us your expertise with the library!
[ad_2]