CarAppExtender.Builder
public
static
final
class
CarAppExtender.Builder
extends Object
java.lang.Object | |
↳ | com.google.android.libraries.car.app.notification.CarAppExtender.Builder |
A builder of CarAppExtender
.
Summary
Public constructors | |
---|---|
Builder()
|
Public methods | |
---|---|
CarAppExtender.Builder
|
addAction(int icon, CharSequence title, PendingIntent intent)
Adds an action to this notification. |
CarAppExtender
|
build()
|
CarAppExtender.Builder
|
clearActions()
Clears any actions that may have been added with |
CarAppExtender.Builder
|
setContentIntent(PendingIntent contentIntent)
Supplies a |
CarAppExtender.Builder
|
setContentText(CharSequence contentText)
Sets the content text of the notification in the car screen, or |
CarAppExtender.Builder
|
setContentTitle(CharSequence contentTitle)
Sets the title of the notification in the car screen, or |
CarAppExtender.Builder
|
setDeleteIntent(PendingIntent deleteIntent)
Supplies a |
CarAppExtender.Builder
|
setImportance(int importance)
Sets the importance of the notification in the car screen. |
CarAppExtender.Builder
|
setLargeIcon(Bitmap bitmap)
Sets the large icon of the notification in the car screen, or |
CarAppExtender.Builder
|
setSmallIcon(int iconResId)
Sets the small icon of the notification in the car screen, or |
Inherited methods | |
---|---|
Public constructors
Builder
public Builder ()
Public methods
addAction
public CarAppExtender.Builder addAction (int icon, CharSequence title, PendingIntent intent)
Adds an action to this notification.
Actions are typically displayed by the system as a button adjacent to the notification content.
A notification may offer up to 2 actions. The system may not display some actions in the compact notification UI (e.g. heads-up-notifications).
If one or more action is added with this method, any action added by NotificationCompat.Builder.addAction(int, CharSequence, PendingIntent)
will be ignored.
This method is equivalent to NotificationCompat.Builder.addAction(int, CharSequence, PendingIntent)
for the car screen.
Parameters | |
---|---|
icon |
int : resource ID of a drawable that represents the action. In order to display the
actions properly, a valid resource id for the icon must be provided. |
title |
CharSequence : text describing the action. |
intent |
PendingIntent : PendingIntent to send when the action is invoked. In the case of
navigation notifications in the rail widget, this intent will be sent when the user taps
on the action icon in the rail widget. |
Returns | |
---|---|
CarAppExtender.Builder |
Throws | |
---|---|
NullPointerException |
if title is null . |
NullPointerException |
if intent is null .
|
clearActions
public CarAppExtender.Builder clearActions ()
Clears any actions that may have been added with addAction(int, CharSequence, PendingIntent)
up to this point.
Returns | |
---|---|
CarAppExtender.Builder |
setContentIntent
public CarAppExtender.Builder setContentIntent (PendingIntent contentIntent)
Supplies a PendingIntent
to send when the notification is clicked in the car.
If set to null
, the notification's content intent will be used.
In the case of navigation notifications in the rail widget, this intent will be sent when the user taps on the rail widget.
This method is equivalent to NotificationCompat.Builder.setContentIntent(PendingIntent)
for the
car screen.
Parameters | |
---|---|
contentIntent |
PendingIntent : override for the notification's content intent.
|
Returns | |
---|---|
CarAppExtender.Builder |
setContentText
public CarAppExtender.Builder setContentText (CharSequence contentText)
Sets the content text of the notification in the car screen, or null
to not override
the content text.
This method is equivalent to NotificationCompat.Builder.setContentText(CharSequence)
for the car
screen.
Parameters | |
---|---|
contentText |
CharSequence : override for the notification's content text. If set to an empty string,
it will be treated as if there is no context text. |
Returns | |
---|---|
CarAppExtender.Builder |
Throws | |
---|---|
NullPointerException |
if contentText is null
|
setContentTitle
public CarAppExtender.Builder setContentTitle (CharSequence contentTitle)
Sets the title of the notification in the car screen, or null
to not override the
notification title.
This will be the most prominently displayed text in the car notification.
This method is equivalent to NotificationCompat.Builder.setContentTitle(CharSequence)
for the car
screen.
Parameters | |
---|---|
contentTitle |
CharSequence |
Returns | |
---|---|
CarAppExtender.Builder |
setDeleteIntent
public CarAppExtender.Builder setDeleteIntent (PendingIntent deleteIntent)
Supplies a PendingIntent
to send when the user clears the notification by either
using the "clear all" functionality in the notification center, or tapping the individual
"close" buttons on the notification in the car screen.
If set to null
, the notification's content intent will be used.
This method is equivalent to NotificationCompat.Builder.setDeleteIntent(PendingIntent)
for the car
screen.
Parameters | |
---|---|
deleteIntent |
PendingIntent : override for the notification's delete intent.
|
Returns | |
---|---|
CarAppExtender.Builder |
setImportance
public CarAppExtender.Builder setImportance (int importance)
Sets the importance of the notification in the car screen.
The default value is NotificationManagerCompat.IMPORTANCE_UNSPECIFIED
.
The importance is used to determine whether the notification will show as a HUN on the car screen. See the class description for more details.
See NotificationManagerCompat
for all supported importance
values.
Parameters | |
---|---|
importance |
int |
Returns | |
---|---|
CarAppExtender.Builder |
setLargeIcon
public CarAppExtender.Builder setLargeIcon (Bitmap bitmap)
Sets the large icon of the notification in the car screen, or null
to not override
the large icon of the notification.
This is used as the secondary icon to represent the notification in the notification center.
This method is equivalent to NotificationCompat.Builder.setLargeIcon(Bitmap)
for the car screen.
The large icon will be shown in the notification badge. If the large icon is not set in
the CarAppExtender
or the notification, the small icon will show instead.
Parameters | |
---|---|
bitmap |
Bitmap |
Returns | |
---|---|
CarAppExtender.Builder |
setSmallIcon
public CarAppExtender.Builder setSmallIcon (int iconResId)
Sets the small icon of the notification in the car screen, or Resources.ID_NULL
to
not override the notification small icon.
This is used as the primary icon to represent the notification.
This method is equivalent to NotificationCompat.Builder.setSmallIcon(int)
for the car screen.
Parameters | |
---|---|
iconResId |
int |
Returns | |
---|---|
CarAppExtender.Builder |