belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1
NotificationCompat.CarExtender
public
static
final
class
NotificationCompat.CarExtender
extends Object
implements
NotificationCompat.Extender
java.lang.Object | |
↳ | android.support.v4.app.NotificationCompat.CarExtender |
Helper class to add Android Auto extensions to notifications. To create a notification with car extensions:
- Create an
NotificationCompat.Builder
, setting any desired properties. - Create a
NotificationCompat.CarExtender
. - Set car-specific properties using the
add
andset
methods ofNotificationCompat.CarExtender
. - Call
extend(NotificationCompat.Extender)
to apply the extensions to a notification. - Post the notification to the notification system with the
NotificationManagerCompat.notify(...)
methods and not theNotificationManager.notify(...)
methods.
Notification notification = new NotificationCompat.Builder(context) ... .extend(new CarExtender() .set*(...)) .build();
Car extensions can be accessed on an existing notification by using the
CarExtender(Notification)
constructor, and then using the get
methods
to access values.
Summary
Nested classes | |
---|---|
class |
NotificationCompat.CarExtender.UnreadConversation
A class which holds the unread messages from a conversation. |
Public constructors | |
---|---|
NotificationCompat.CarExtender()
Create a |
|
NotificationCompat.CarExtender(Notification notification)
Create a |
Public methods | |
---|---|
NotificationCompat.Builder
|
extend(NotificationCompat.Builder builder)
Apply car extensions to a notification that is being built. |
int
|
getColor()
Gets the accent color. |
Bitmap
|
getLargeIcon()
Gets the large icon used in this car notification, or null if no icon has been set. |
NotificationCompat.CarExtender.UnreadConversation
|
getUnreadConversation()
Returns the unread conversation conveyed by this notification. |
NotificationCompat.CarExtender
|
setColor(int color)
Sets the accent color to use when Android Auto presents the notification. |
NotificationCompat.CarExtender
|
setLargeIcon(Bitmap largeIcon)
Sets the large icon of the car notification. |
NotificationCompat.CarExtender
|
setUnreadConversation(NotificationCompat.CarExtender.UnreadConversation unreadConversation)
Sets the unread conversation in a message notification. |
Inherited methods | |
---|---|
From
class
java.lang.Object
| |
From
interface
android.support.v4.app.NotificationCompat.Extender
|
Public constructors
NotificationCompat.CarExtender
NotificationCompat.CarExtender ()
Create a NotificationCompat.CarExtender
with default options.
NotificationCompat.CarExtender
NotificationCompat.CarExtender (Notification notification)
Create a NotificationCompat.CarExtender
from the CarExtender options of an existing Notification.
Parameters | |
---|---|
notification |
Notification : The notification from which to copy options.
|
Public methods
extend
NotificationCompat.Builder extend (NotificationCompat.Builder builder)
Apply car extensions to a notification that is being built. This is typically called by
the extend(NotificationCompat.Extender)
method of NotificationCompat.Builder
.
Parameters | |
---|---|
builder |
NotificationCompat.Builder : the builder to be modified. |
Returns | |
---|---|
NotificationCompat.Builder |
the build object for chaining. |
getLargeIcon
Bitmap getLargeIcon ()
Gets the large icon used in this car notification, or null if no icon has been set.
Returns | |
---|---|
Bitmap |
The large icon for the car notification. |
See also:
getUnreadConversation
NotificationCompat.CarExtender.UnreadConversation getUnreadConversation ()
Returns the unread conversation conveyed by this notification.
Returns | |
---|---|
NotificationCompat.CarExtender.UnreadConversation |
setColor
NotificationCompat.CarExtender setColor (int color)
Sets the accent color to use when Android Auto presents the notification.
Android Auto uses the color set with setColor(int)
to accent the displayed notification. However, not all colors are acceptable in an
automotive setting. This method can be used to override the color provided in the
notification in such a situation.
Parameters | |
---|---|
color |
int |
Returns | |
---|---|
NotificationCompat.CarExtender |
setLargeIcon
NotificationCompat.CarExtender setLargeIcon (Bitmap largeIcon)
Sets the large icon of the car notification.
If no large icon is set in the extender, Android Auto will display the icon
specified by setLargeIcon(android.graphics.Bitmap)
Parameters | |
---|---|
largeIcon |
Bitmap : The large icon to use in the car notification. |
Returns | |
---|---|
NotificationCompat.CarExtender |
This object for method chaining. |
setUnreadConversation
NotificationCompat.CarExtender setUnreadConversation (NotificationCompat.CarExtender.UnreadConversation unreadConversation)
Sets the unread conversation in a message notification.
Parameters | |
---|---|
unreadConversation |
NotificationCompat.CarExtender.UnreadConversation : The unread part of the conversation this notification conveys. |
Returns | |
---|---|
NotificationCompat.CarExtender |
This object for method chaining. |
Annotations
Interfaces
- ActionBarDrawerToggle.Delegate
- ActionBarDrawerToggle.DelegateProvider
- ActivityCompat.OnRequestPermissionsResultCallback
- ActivityCompat.PermissionCompatDelegate
- FragmentManager.BackStackEntry
- FragmentManager.OnBackStackChangedListener
- LoaderManager.LoaderCallbacks
- NotificationCompat.Action.Extender
- NotificationCompat.Extender
- SharedElementCallback.OnSharedElementsReadyListener
- TaskStackBuilder.SupportParentable
Classes
- ActionBarDrawerToggle
- ActivityCompat
- ActivityManagerCompat
- ActivityOptionsCompat
- AlarmManagerCompat
- AppLaunchChecker
- AppOpsManagerCompat
- BundleCompat
- DialogFragment
- Fragment
- Fragment.SavedState
- FragmentActivity
- FragmentContainer
- FragmentController
- FragmentHostCallback
- FragmentManager
- FragmentManager.FragmentLifecycleCallbacks
- FragmentManagerNonConfig
- FragmentPagerAdapter
- FragmentStatePagerAdapter
- FragmentTabHost
- FragmentTransaction
- FrameMetricsAggregator
- JobIntentService
- ListFragment
- LoaderManager
- NavUtils
- NotificationCompat
- NotificationCompat.Action
- NotificationCompat.Action.Builder
- NotificationCompat.Action.WearableExtender
- NotificationCompat.BigPictureStyle
- NotificationCompat.BigTextStyle
- NotificationCompat.Builder
- NotificationCompat.CarExtender
- NotificationCompat.CarExtender.UnreadConversation
- NotificationCompat.CarExtender.UnreadConversation.Builder
- NotificationCompat.DecoratedCustomViewStyle
- NotificationCompat.InboxStyle
- NotificationCompat.MessagingStyle
- NotificationCompat.MessagingStyle.Message
- NotificationCompat.Style
- NotificationCompat.WearableExtender
- NotificationCompatExtras
- NotificationCompatSideChannelService
- NotificationManagerCompat
- RemoteInput
- RemoteInput.Builder
- ServiceCompat
- ShareCompat
- ShareCompat.IntentBuilder
- ShareCompat.IntentReader
- SharedElementCallback
- TaskStackBuilder
Exceptions
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-11 UTC.