Notification.CallStyle
public
static
class
Notification.CallStyle
extends Notification.Style
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
Inherited methods |
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long timeout, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long timeout)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
|
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 . |
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 . |
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 . |
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.
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.
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 |
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 . |
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 . |