Notification.CallStyle
public
static
class
Notification.CallStyle
extends Notification.Style
java.lang.Object | ||
↳ | 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 | |
---|---|
int |
CALL_TYPE_INCOMING
Call type for incoming calls. |
int |
CALL_TYPE_ONGOING
Call type for ongoing calls. |
int |
CALL_TYPE_SCREENING
Call type for calls that are being screened. |
int |
CALL_TYPE_UNKNOWN
Unknown call type. |
Inherited fields |
---|
Public methods | |
---|---|
static
Notification.CallStyle
|
forIncomingCall(Person person, PendingIntent declineIntent, PendingIntent answerIntent)
Create a CallStyle for an incoming call. |
static
Notification.CallStyle
|
forOngoingCall(Person person, PendingIntent hangUpIntent)
Create a CallStyle for an ongoing call. |
static
Notification.CallStyle
|
forScreeningCall(Person person, PendingIntent hangUpIntent, PendingIntent answerIntent)
Create a CallStyle for a call that is being screened. |
Notification.CallStyle
|
setAnswerButtonColorHint(int color)
Optional color to be used as a hint for the Answer action button's color. |
Notification.CallStyle
|
setDeclineButtonColorHint(int color)
Optional color to be used as a hint for the Decline or Hang Up action button's color. |
Notification.CallStyle
|
setIsVideo(boolean isVideo)
Sets whether the call is a video call, which may affect the icons or text used on the required action buttons. |
Notification.CallStyle
|
setVerificationIcon(Icon verificationIcon)
Optional icon to be displayed with |
Notification.CallStyle
|
setVerificationText(CharSequence verificationText)
Optional text to be displayed with an |
Inherited methods | |
---|---|
Constants
CALL_TYPE_INCOMING
public static final int CALL_TYPE_INCOMING
Call type for incoming calls.
See Notification.EXTRA_CALL_TYPE
.
Constant Value: 1 (0x00000001)
CALL_TYPE_ONGOING
public static final int CALL_TYPE_ONGOING
Call type for ongoing calls.
See Notification.EXTRA_CALL_TYPE
.
Constant Value: 2 (0x00000002)
CALL_TYPE_SCREENING
public static final int CALL_TYPE_SCREENING
Call type for calls that are being screened.
See Notification.EXTRA_CALL_TYPE
.
Constant Value: 3 (0x00000003)
CALL_TYPE_UNKNOWN
public static final int CALL_TYPE_UNKNOWN
Unknown call type.
See Notification.EXTRA_CALL_TYPE
.
Constant Value: 0 (0x00000000)
Public methods
forIncomingCall
public static Notification.CallStyle forIncomingCall (Person person, PendingIntent declineIntent, PendingIntent answerIntent)
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 . |
Returns | |
---|---|
Notification.CallStyle |
This value cannot be null . |
forOngoingCall
public static Notification.CallStyle forOngoingCall (Person person, PendingIntent hangUpIntent)
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 . |
Returns | |
---|---|
Notification.CallStyle |
This value cannot be null . |
forScreeningCall
public static Notification.CallStyle forScreeningCall (Person person, PendingIntent hangUpIntent, PendingIntent answerIntent)
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 . |
Returns | |
---|---|
Notification.CallStyle |
This value cannot be null . |
setAnswerButtonColorHint
public Notification.CallStyle setAnswerButtonColorHint (int color)
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.
Parameters | |
---|---|
color |
int |
Returns | |
---|---|
Notification.CallStyle |
This value cannot be null . |
setDeclineButtonColorHint
public Notification.CallStyle setDeclineButtonColorHint (int color)
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.
Parameters | |
---|---|
color |
int |
Returns | |
---|---|
Notification.CallStyle |
This value cannot be null . |
setIsVideo
public Notification.CallStyle setIsVideo (boolean isVideo)
Sets whether the call is a video call, which may affect the icons or text used on the required action buttons.
Parameters | |
---|---|
isVideo |
boolean |
Returns | |
---|---|
Notification.CallStyle |
This value cannot be null . |
setVerificationIcon
public Notification.CallStyle setVerificationIcon (Icon verificationIcon)
Optional icon to be displayed with text
as a verification status of the caller.
Parameters | |
---|---|
verificationIcon |
Icon : This value may be null . |
Returns | |
---|---|
Notification.CallStyle |
This value cannot be null . |
setVerificationText
public Notification.CallStyle setVerificationText (CharSequence verificationText)
Optional text to be displayed with an icon
as a verification status of the caller.
Parameters | |
---|---|
verificationText |
CharSequence : This value may be null . |
Returns | |
---|---|
Notification.CallStyle |
This value cannot be null . |