VisualVoicemailService


public abstract class VisualVoicemailService
extends Service

java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ android.telephony.VisualVoicemailService


This service is implemented by dialer apps that wishes to handle OMTP or similar visual voicemails. Telephony binds to this service when the cell service is first connected, a visual voicemail SMS has been received, or when a SIM has been removed. Telephony will only bind to the default dialer for such events (See TelecomManager#getDefaultDialerPackage()). The CarrierMessagingService precedes the VisualVoicemailService in the SMS filtering chain and may intercept the visual voicemail SMS before it reaches this service.

To extend this class, The service must be declared in the manifest file with the Manifest.permission.BIND_VISUAL_VOICEMAIL_SERVICE permission and include an intent filter with the SERVICE_INTERFACE action.

Below is an example manifest registration for a VisualVoicemailService.

 <service android:name="your.package.YourVisualVoicemailServiceImplementation"
          android:permission="android.permission.BIND_VISUAL_VOICEMAIL_SERVICE">
      <intent-filter>
          <action android:name="android.telephony.VisualVoicemailService"/>
      </intent-filter>
 </service>
 
 

Summary

Nested classes

class VisualVoicemailService.VisualVoicemailTask

Represents a visual voicemail event which needs to be handled. 

Constants

String SERVICE_INTERFACE

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

Inherited constants

Public constructors

VisualVoicemailService()

Public methods

IBinder onBind(Intent intent)

Return the communication channel to the service.

abstract void onCellServiceConnected(VisualVoicemailService.VisualVoicemailTask task, PhoneAccountHandle phoneAccountHandle)

Called when the cellular service is connected on a PhoneAccountHandle for the first time, or when the carrier config has changed.

abstract void onSimRemoved(VisualVoicemailService.VisualVoicemailTask task, PhoneAccountHandle phoneAccountHandle)

Called when a SIM is removed.

abstract void onSmsReceived(VisualVoicemailService.VisualVoicemailTask task, VisualVoicemailSms sms)

Called when a SMS matching the VisualVoicemailSmsFilterSettings set by TelephonyManager.setVisualVoicemailSmsFilterSettings(android.telephony.VisualVoicemailSmsFilterSettings) is received.

abstract void onStopped(VisualVoicemailService.VisualVoicemailTask task)

Called before the system is about to terminate a task.

Inherited methods

Constants

SERVICE_INTERFACE

Added in API level 26
public static final String SERVICE_INTERFACE

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

Constant Value: "android.telephony.VisualVoicemailService"

Public constructors

VisualVoicemailService

public VisualVoicemailService ()

Public methods

onBind

Added in API level 26
public 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.

onCellServiceConnected

Added in API level 26
public abstract void onCellServiceConnected (VisualVoicemailService.VisualVoicemailTask task, 
                PhoneAccountHandle phoneAccountHandle)

Called when the cellular service is connected on a PhoneAccountHandle for the first time, or when the carrier config has changed. It will not be called when the signal is lost then restored.
This method must be called from the main thread of your app.

Parameters
task VisualVoicemailService.VisualVoicemailTask: The task representing this event. VisualVoicemailTask#finish() must be called when the task is completed.

phoneAccountHandle PhoneAccountHandle: The PhoneAccountHandle triggering this event.

onSimRemoved

Added in API level 26
public abstract void onSimRemoved (VisualVoicemailService.VisualVoicemailTask task, 
                PhoneAccountHandle phoneAccountHandle)

Called when a SIM is removed.
This method must be called from the main thread of your app.

Parameters
task VisualVoicemailService.VisualVoicemailTask: The task representing this event. VisualVoicemailTask#finish() must be called when the task is completed.

phoneAccountHandle PhoneAccountHandle: The PhoneAccountHandle triggering this event.

onSmsReceived

Added in API level 26
public abstract void onSmsReceived (VisualVoicemailService.VisualVoicemailTask task, 
                VisualVoicemailSms sms)

Called when a SMS matching the VisualVoicemailSmsFilterSettings set by TelephonyManager.setVisualVoicemailSmsFilterSettings(android.telephony.VisualVoicemailSmsFilterSettings) is received.
This method must be called from the main thread of your app.

Parameters
task VisualVoicemailService.VisualVoicemailTask: The task representing this event. VisualVoicemailTask#finish() must be called when the task is completed.

sms VisualVoicemailSms: The content of the received SMS.

onStopped

Added in API level 26
public abstract void onStopped (VisualVoicemailService.VisualVoicemailTask task)

Called before the system is about to terminate a task. The service should persist any necessary data and call finish on the task immediately.
This method must be called from the main thread of your app.

Parameters
task VisualVoicemailService.VisualVoicemailTask