Added in API level 26

VisualVoicemailService

abstract class VisualVoicemailService : Service
kotlin.Any
   ↳ 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 android.service.carrier.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 android.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.

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

Summary

Nested classes
open

Represents a visual voicemail event which needs to be handled.

Constants
static String

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

Inherited constants
Public constructors

Public methods
open IBinder?
onBind(intent: Intent!)

abstract Unit

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

abstract Unit

Called when a SIM is removed.

abstract Unit

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

abstract Unit

Called before the system is about to terminate a task.

Inherited functions

Constants

SERVICE_INTERFACE

Added in API level 26
static val SERVICE_INTERFACE: String

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

Value: "android.telephony.VisualVoicemailService"

Public constructors

VisualVoicemailService

VisualVoicemailService()

Public methods

onBind

Added in API level 26
open fun onBind(intent: Intent!): IBinder?
Parameters
intent Intent!: The Intent that was used to bind to this service, as given to android.content.Context#bindService. Note that any extras that were included with the Intent at that point will not be seen here.
Return
IBinder? Return an IBinder through which clients can call on to the service.

onCellServiceConnected

Added in API level 26
abstract fun onCellServiceConnected(
    task: VisualVoicemailService.VisualVoicemailTask!,
    phoneAccountHandle: PhoneAccountHandle!
): Unit

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
abstract fun onSimRemoved(
    task: VisualVoicemailService.VisualVoicemailTask!,
    phoneAccountHandle: PhoneAccountHandle!
): Unit

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
abstract fun onSmsReceived(
    task: VisualVoicemailService.VisualVoicemailTask!,
    sms: VisualVoicemailSms!
): Unit

Called when a SMS matching the VisualVoicemailSmsFilterSettings set by android.telephony.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
abstract fun onStopped(task: VisualVoicemailService.VisualVoicemailTask!): Unit

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.