Dela via


TelecomManager.SilenceRinger Method

Definition

Silences the ringer if a ringing call exists.

[Android.Runtime.Register("silenceRinger", "()V", "GetSilenceRingerHandler", ApiSince=23)]
[Android.Runtime.RequiresPermission("android.permission.MODIFY_PHONE_STATE")]
public virtual void SilenceRinger ();
[<Android.Runtime.Register("silenceRinger", "()V", "GetSilenceRingerHandler", ApiSince=23)>]
[<Android.Runtime.RequiresPermission("android.permission.MODIFY_PHONE_STATE")>]
abstract member SilenceRinger : unit -> unit
override this.SilenceRinger : unit -> unit
Attributes

Remarks

Silences the ringer if a ringing call exists.

This method can only be relied upon to stop the ringtone for a call if the ringtone has already started playing. It is intended to handle use-cases such as silencing a ringing call when the user presses the volume button during ringing.

If this method is called prior to when the ringtone begins playing, the ringtone will not be silenced. As such it is not intended as a means to avoid playing of a ringtone.

A dialer app which wants to have more control over ringtone playing should declare TelecomManager#METADATA_IN_CALL_SERVICE_RINGING in the manifest entry for their InCallService implementation to indicate that the app wants to be responsible for playing the ringtone for all incoming calls.

Requires permission: android.Manifest.permission#MODIFY_PHONE_STATE or that the app fills the dialer role (see #getDefaultDialerPackage()).

Java documentation for android.telecom.TelecomManager.silenceRinger().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to