Tag Archives: Connectivity

Alpha Release of Telecom Library

Posted by Luke Hopkins - Developer Relations Engineer

Today we’re thrilled to announce that the Telecom jetpack library is now in alpha for developers who already have or are interested in creating voice and/or video calling applications. Our aim with this library is to simplify the developer integration process and improve VoIP calling across Android surfaces.

androidx.core:core-telecom:1.0.0-alpha02

What’s in the Public Alpha release

This release supports a variety of Telecom features, including:

Platform synchronization

For surfaces like watches, this library allows the user to answer, decline, hang up and mute your call through a simple API, as well as displaying useful information such as who the caller is.

ALT TEXT

This is also beneficial because if the device is aware of your call, should other calls such a PTSN/SIM based call come through, you can give the user a chance to hold the call they are currently on.

Dedicated foreground support

With the changes to Android 14, which require applications to specify foreground service types, this library takes care of the requirements for you. For more information, please refer to the foreground service documentation.

Foreground support allows users to stay connected to their calls even after the user has navigated away from your app... You won’t need to build your own foreground services or worry about the background state of your application.

Audio Routing

Instead of using the audio manager to track state, focus and obtain a list of audio devices, this Telecom library will list all available endpoints to your application for streaming audio to/from Bluetooth hearables, hearing aids, wired headphones, and other surfaces, thus giving users access and control to a wide range of hearable devices.

Backwards Compatibility

Backwards compatibility works all the way down to Android O (API Level 26) on devices which support the Telecom stack which means implementing the simple API surface below supports a wide range of devices.

callsManager.addCall(
        attributes,
        onIsCallAnswered,
        onIsCallDisconnected,
        onIsCallActive,
        onIsCallInactive
       ){


        val callScope=this

}

You can also query the packagemanager to know if the device supports Telecom.

packagemanager.hasSystemFeature(PackageManager.FEATURE_TELECOM)

Why use this library over Platform API

You might be thinking, why make this move to a new library when I could just similarly migrate the deprecated APIs to the new APIs added in Android 14. Well this library offers:

New Features

We will have more exciting additions coming to the Telecom library in the coming months which are exclusive to the jetpack library. These included expanded support for VoIP Call actions such as being able to locally mute the VoIP app for the specific call and being able to display the name of the speaker on another surface such as Android Auto. We also have a new feature coming soon that will allow users to transfer their ongoing VoIP calls between their phones and tablets.

Backward Compatibility

As previously stated, this library supports backward compatibility, which means that your app will not only be supported on a wider range of devices, but we can resolve interoperability issues with older Android versions.

A simple API surface and a large coverage of devices, means this library is the goto solution for calling applications.

Migrating from ConnectionService to CallsManager

Even if you already have an existing ConnectionService integration for your VoIP app, you should consider migrating to CallsManager, as mentioned above we have a lot of exciting 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 straightforward to implement but is not a simple case of changing namespace. You can think of CallManager representing ConnectionService and CallControlScope representing ConnectionService.

Below shows the difference between how to switch audio using connection service to CallControlScope.

You can also query the packagemanager to know if the device supports Telecom.

cconnectionService.setAudioRoute (int route)

InCallService- Android 13

when (requestEndpointChange(newEndpoint)) { 

     is CallControlResult.Success -> { 
                                      // Device changed 
          } 

          is CallControlResult.Error -> { 

          } 
  }

Jetpack Library

Another example showing how simple this API is to use, you can add a call to the platform and define you 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 this scope you can answer, hold, disconnect and get a list of hearable devices.

//call control scope 
launch { 
            availableEndpoints.collect { 

             ..... 

            }

          }

Getting started

Head over to our updated developer guide to get started and try out the Public Alpha release of the Telecom library. Make sure to check out our sample app found on GitHub for a demonstration on how to work with the various APIs.

This sample application implements all the latest features for the Telecom library showing how to do:

  • Audio Routing
  • Foreground Services
  • Accept, Disconnect, Reject and Hold calls
  • Watch integration
  • CallStyle notification

Feedback

We’d love to hear from you during this Alpha launch to help us shape the library and influence future roadmapping, so please share your feedback and let us know your experience with the library!

Announcing Cross device SDK Developer Preview for building rich multi-device experiences on Android

Posted by Alex Rocha - Developer Relations Engineer Manager, Ryan Ausanka-Crues - Eng Manager, Multi-device development, Stella Loh - Product Manager, Multi-device development

Today we’re launching our Developer Preview of the new Cross device SDK for Android. First announced during the Google I/O ‘22 Multi-device development session, our Cross device SDK allows developers to build rich multi-device experiences with a simple and intuitive set of APIs. This SDK abstracts away the intricacies involved with working with device discovery, authentication, and connection protocols, allowing you to focus on what matters most—building delightful user experiences and connecting these experiences across a variety of form factors and platforms.

What’s in Developer Preview

This initial release contains a set of rich APIs centered around the core functionality of Device discovery, Secure connections, and Multi-device Sessions.

  1. Device discovery: Easily find nearby devices, authorize peer-to-peer communication, and start the target application on receiving devices.
  2. Secure connections: Enable encrypted, low-latency bi-directional data sharing between authorized devices.
  3. Multi-device Sessions: Enable transferring or extending an application’s user experience across multiple devices.

In turn, this will allow you to build compelling cross-device experiences by enabling and simplifying the following use cases:

  • Discovering and authorizing communication with nearby devices.
  • Sharing an app’s current state with the same app on another device.
  • Starting the app on a secondary device without having to keep the app running in background.
  • Establishing secure connections for devices to communicate with each other.
  • Enabling task handoff where the user starts a task on one device, and can easily continue on another device.

Starting today with a Developer Preview for Android phones and tablets, the Cross device SDK will be available later for other Android surfaces and non-Android OSs.

Under The Hood

The Cross device SDK provides a software abstraction layer that handles all aspects of cross-device connectivity, leveraging wireless technologies such as Bluetooth, Wi-Fi, and Ultra-wide band; our SDK does all the heavy-lifting under the hood, offering you a modular,connectivity-agnostic API that supports bi-directional communication between devices and is backward compatible to Android 8. In addition, apps will not have to declare or request Runtime Permissions for any of the underlying connectivity protocols used (such as BLUETOOTH_CONNECT, BLUETOOTH_SCAN, ACCESS_FINE_LOCATION, etc.), and the user can allow apps to connect to only the device(s) they selected.

Getting started with Developer Preview

Head over to our developer guide to get started and try out the Developer Preview of the Cross device SDK for Android. Make sure to check out our Rock Paper Scissor sample app (Kotlin and Java) on GitHub for a demonstration on how to work with the various APIs and our Google I/O ‘22 Multi-device development session for a general overview of the SDK.

Feedback

We’d love to hear from you during this initial Developer Preview launch to help us shape the SDK and influence future roadmapping, so please share your feedback and let us know your experience with the SDK!