CallIconExtension
@ExperimentalAppActions
public interface CallIconExtension
Adds support for displaying a call icon on remote surfaces for a given call.
This interface allows a VoIP app to provide a URI representing the call icon, which can then be displayed on remote surfaces (e.g., a connected car's display).
Important Manifest Declarations:
-
InCallServiceIntent Filter: VoIP apps must declare the following<queries>intent filter in theirAndroidManifest.xmlto allow remote surfaces to be discoverable when granting URI permissions:``xml <queries> <intent> <action android:name="android.telecom.InCallService" /> </intent> </queries> `` -
FileProviderDefinition: To securely share call icon images with remote surfaces, it is strongly recommended to use aFileProvider. AFileProvidergeneratescontent://URIs, which allow temporary, secure access to specific files without requiring broad file system permissions. Define aFileProviderin yourAndroidManifest.xmlsimilar to this:`` <provider android:name="androidx.core.content.FileProvider" android:authorities="androidx.core.telecom.test.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" /> </provider> ``with your app's unique authority. -
FileProviderConfiguration: Create afile_paths.xmlfile in yourres/xmldirectory (as referenced in themeta-dataof theFileProviderdefinition) to specify the directories your app can share icons from:`` <paths> <files-path name="my_images" path="images/" /> </paths> ``This example allows sharing files from the
imagessubdirectory of your app's internal storagefilesdirectory. Adjust thenameandpathaccording to your needs.
Generating content:// URIs:
In your app's code, use FileProvider.getUriForFile() to generate a secure content:// URI for your call icon file:
// Assuming you have a file named 'call_icon.png' in your app's internal storage
// directory, specifically within a subdirectory named 'images'
File iconFile = new File(getFilesDir(), "images/call_icon.png");
Uri iconUri = FileProvider.getUriForFile(
context,
"androidx.core.telecom.test.fileprovider", // Your FileProvider authority
iconFile
);Using the content:// URI:
Pass the generated content:// URI to the addCallIconExtension method when setting up your call. Remote surfaces will then be able to securely access and display the icon.
Failure to properly declare the InCallService intent filter or to use a FileProvider for icon sharing will prevent remote surfaces from displaying the call icon.
| See also | |
|---|---|
addCallIconExtension |
|
FileProvider |
Summary
Public methods |
|
|---|---|
abstract void |
updateCallIconUri(@NonNull Uri iconUri)Updates the call icon displayed on remote surfaces. |
Public methods
updateCallIconUri
abstract void updateCallIconUri(@NonNull Uri iconUri)
Updates the call icon displayed on remote surfaces.
Call this function whenever the call icon changes. The provided iconUri will be used to fetch and display the new icon.