Added in API level 31

CallStyle

open class CallStyle : Notification.Style
kotlin.Any
   ↳ android.app.Notification.Style
   ↳ android.app.Notification.CallStyle

Helper class for generating large-format notifications that include a large image attachment. Here's how you'd set the CallStyle on a notification:

Notification notif = new Notification.Builder(mContext)
      .setSmallIcon(R.drawable.new_post)
      .setStyle(Notification.CallStyle.forIncomingCall(caller, declineIntent, answerIntent))
      .build();
  

Summary

Constants
static Int

Call type for incoming calls.

static Int

Call type for ongoing calls.

static Int

Call type for calls that are being screened.

static Int

Unknown call type.

Public methods
open static Notification.CallStyle
forIncomingCall(person: Person, declineIntent: PendingIntent, answerIntent: PendingIntent)

Create a CallStyle for an incoming call.

open static Notification.CallStyle
forOngoingCall(person: Person, hangUpIntent: PendingIntent)

Create a CallStyle for an ongoing call.

open static Notification.CallStyle
forScreeningCall(person: Person, hangUpIntent: PendingIntent, answerIntent: PendingIntent)

Create a CallStyle for a call that is being screened.

open Notification.CallStyle

Optional color to be used as a hint for the Answer action button's color.

open Notification.CallStyle

Optional color to be used as a hint for the Decline or Hang Up action button's color.

open Notification.CallStyle
setIsVideo(isVideo: Boolean)

Sets whether the call is a video call, which may affect the icons or text used on the required action buttons.

open Notification.CallStyle
setVerificationIcon(verificationIcon: Icon?)

Optional icon to be displayed with text as a verification status of the caller.

open Notification.CallStyle
setVerificationText(verificationText: CharSequence?)

Optional text to be displayed with an icon as a verification status of the caller.

Inherited functions
Inherited properties

Constants

CALL_TYPE_INCOMING

Added in API level 34
static val CALL_TYPE_INCOMING: Int

Call type for incoming calls. See EXTRA_CALL_TYPE.

Value: 1

CALL_TYPE_ONGOING

Added in API level 34
static val CALL_TYPE_ONGOING: Int

Call type for ongoing calls. See EXTRA_CALL_TYPE.

Value: 2

CALL_TYPE_SCREENING

Added in API level 34
static val CALL_TYPE_SCREENING: Int

Call type for calls that are being screened. See EXTRA_CALL_TYPE.

Value: 3

CALL_TYPE_UNKNOWN

Added in API level 34
static val CALL_TYPE_UNKNOWN: Int

Unknown call type. See EXTRA_CALL_TYPE.

Value: 0

Public methods

forIncomingCall

Added in API level 31
open static fun forIncomingCall(
    person: Person,
    declineIntent: PendingIntent,
    answerIntent: PendingIntent
): Notification.CallStyle

Create a CallStyle for an incoming call. This notification will have a decline and an answer action, will allow a single custom action, and will have a default content text for an incoming call.

Parameters
person Person: The person displayed as the caller. The person also needs to have a non-empty name associated with it. This value cannot be null.
declineIntent PendingIntent: The intent to be sent when the user taps the decline action This value cannot be null.
answerIntent PendingIntent: The intent to be sent when the user taps the answer action This value cannot be null.
Return
Notification.CallStyle This value cannot be null.

forOngoingCall

Added in API level 31
open static fun forOngoingCall(
    person: Person,
    hangUpIntent: PendingIntent
): Notification.CallStyle

Create a CallStyle for an ongoing call. This notification will have a hang up action, will allow up to two custom actions, and will have a default content text for an ongoing call.

Parameters
person Person: The person displayed as being on the other end of the call. The person also needs to have a non-empty name associated with it. This value cannot be null.
hangUpIntent PendingIntent: The intent to be sent when the user taps the hang up action This value cannot be null.
Return
Notification.CallStyle This value cannot be null.

forScreeningCall

Added in API level 31
open static fun forScreeningCall(
    person: Person,
    hangUpIntent: PendingIntent,
    answerIntent: PendingIntent
): Notification.CallStyle

Create a CallStyle for a call that is being screened. This notification will have a hang up and an answer action, will allow a single custom action, and will have a default content text for a call that is being screened.

Parameters
person Person: The person displayed as the caller. The person also needs to have a non-empty name associated with it. This value cannot be null.
hangUpIntent PendingIntent: The intent to be sent when the user taps the hang up action This value cannot be null.
answerIntent PendingIntent: The intent to be sent when the user taps the answer action This value cannot be null.
Return
Notification.CallStyle This value cannot be null.

setAnswerButtonColorHint

Added in API level 31
open fun setAnswerButtonColorHint(color: Int): Notification.CallStyle

Optional color to be used as a hint for the Answer action button's color. The system may change this color to ensure sufficient contrast with the background. The system may choose to disregard this hint if the notification is not colorized.

Return
Notification.CallStyle This value cannot be null.

setDeclineButtonColorHint

Added in API level 31
open fun setDeclineButtonColorHint(color: Int): Notification.CallStyle

Optional color to be used as a hint for the Decline or Hang Up action button's color. The system may change this color to ensure sufficient contrast with the background. The system may choose to disregard this hint if the notification is not colorized.

Return
Notification.CallStyle This value cannot be null.

setIsVideo

Added in API level 31
open fun setIsVideo(isVideo: Boolean): Notification.CallStyle

Sets whether the call is a video call, which may affect the icons or text used on the required action buttons.

Return
Notification.CallStyle This value cannot be null.

setVerificationIcon

Added in API level 31
open fun setVerificationIcon(verificationIcon: Icon?): Notification.CallStyle

Optional icon to be displayed with text as a verification status of the caller.

Parameters
verificationIcon Icon?: This value may be null.
Return
Notification.CallStyle This value cannot be null.

setVerificationText

Added in API level 31
open fun setVerificationText(verificationText: CharSequence?): Notification.CallStyle

Optional text to be displayed with an icon as a verification status of the caller.

Parameters
verificationText CharSequence?: This value may be null.
Return
Notification.CallStyle This value cannot be null.