Skip to content

Most visited

Recently visited

navigation

CallScreeningService

public abstract class CallScreeningService
extends Service

java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ android.telecom.CallScreeningService


This service can be implemented by the default dialer (see getDefaultDialerPackage()) to allow or disallow incoming calls before they are shown to a user.

Below is an example manifest registration for a CallScreeningService.

 <service android:name="your.package.YourCallScreeningServiceImplementation"
          android:permission="android.permission.BIND_SCREENING_SERVICE">
      <intent-filter>
          <action android:name="android.telecom.CallScreeningService"/>
      </intent-filter>
 </service>
 
 

Summary

Nested classes

class CallScreeningService.CallResponse

 

Constants

String SERVICE_INTERFACE

The Intent that must be declared as handled by the service.

Inherited constants

From class android.app.Service
From class android.content.Context
From interface android.content.ComponentCallbacks2

Public constructors

CallScreeningService()

Public methods

IBinder onBind(Intent intent)

Return the communication channel to the service.

abstract void onScreenCall(Call.Details callDetails)

Called when a new incoming call is added.

boolean onUnbind(Intent intent)

Called when all clients have disconnected from a particular interface published by the service.

final void respondToCall(Call.Details callDetails, CallScreeningService.CallResponse response)

Responds to the given call, either allowing it or disallowing it.

Inherited methods

From class android.app.Service
From class android.content.ContextWrapper
From class android.content.Context
From class java.lang.Object
From interface android.content.ComponentCallbacks2
From interface android.content.ComponentCallbacks

Constants

SERVICE_INTERFACE

added in API level 24
String SERVICE_INTERFACE

The Intent that must be declared as handled by the service.

Constant Value: "android.telecom.CallScreeningService"

Public constructors

CallScreeningService

added in API level 24
CallScreeningService ()

Public methods

onBind

added in API level 24
IBinder onBind (Intent intent)

Return the communication channel to the service. May return null if clients can not bind to the service. The returned IBinder is usually for a complex interface that has been described using aidl.

Note that unlike other application components, calls on to the IBinder interface returned here may not happen on the main thread of the process. More information about the main thread can be found in Processes and Threads.

Parameters
intent Intent: The Intent that was used to bind to this service, as given to Context.bindService. Note that any extras that were included with the Intent at that point will not be seen here.
Returns
IBinder Return an IBinder through which clients can call on to the service.

onScreenCall

added in API level 24
void onScreenCall (Call.Details callDetails)

Called when a new incoming call is added. respondToCall(Call.Details, CallScreeningService.CallResponse) should be called to allow or disallow the call.

Parameters
callDetails Call.Details: Information about a new incoming call, see Call.Details.

onUnbind

added in API level 24
boolean onUnbind (Intent intent)

Called when all clients have disconnected from a particular interface published by the service. The default implementation does nothing and returns false.

Parameters
intent Intent: The Intent that was used to bind to this service, as given to Context.bindService. Note that any extras that were included with the Intent at that point will not be seen here.
Returns
boolean Return true if you would like to have the service's onRebind(Intent) method later called when new clients bind to it.

respondToCall

added in API level 24
void respondToCall (Call.Details callDetails, 
                CallScreeningService.CallResponse response)

Responds to the given call, either allowing it or disallowing it.

Parameters
callDetails Call.Details: The call to allow.
response CallScreeningService.CallResponse: The CallScreeningService.CallResponse which contains information about how to respond to a call.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.