Skip to content

Most visited

Recently visited

navigation

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 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 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

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

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 setVisualVoicemailSmsFilterSettings(VisualVoicemailSmsFilterSettings) is received.

abstract void onStopped(VisualVoicemailService.VisualVoicemailTask task)

Called before the system is about to terminate a task.

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 26
String SERVICE_INTERFACE

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

Constant Value: "android.telephony.VisualVoicemailService"

Public constructors

VisualVoicemailService

added in API level 26
VisualVoicemailService ()

Public methods

onBind

added in API level 26
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
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. finish() must be called when the task is completed.

phoneAccountHandle PhoneAccountHandle: The PhoneAccountHandle triggering this event.

onSimRemoved

added in API level 26
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. finish() must be called when the task is completed.

phoneAccountHandle PhoneAccountHandle: The PhoneAccountHandle triggering this event.

onSmsReceived

added in API level 26
void onSmsReceived (VisualVoicemailService.VisualVoicemailTask task, 
                VisualVoicemailSms sms)

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

This method must be called from the main thread of your app.

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

sms VisualVoicemailSms: The content of the received SMS.

onStopped

added in API level 26
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

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

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 short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)