Skip to content

[Android] Notification Styles

Elvin Thudugala edited this page Mar 29, 2026 · 3 revisions

Android Notification Styles

Android supports several rich notification layouts beyond the default single-line text view. This plugin exposes these through the AndroidOptions.Style property on NotificationRequest.

Set AndroidOptions.Style to an instance of one of the style classes described below. Leave it null (the default) to keep the automatic behaviour: a BigPicture style is used when NotificationRequest.Image is set, otherwise a BigText style is used when Description is non-empty.

All style classes live in the Plugin.LocalNotification.Core.Models.AndroidOption namespace.


Inbox Style

AndroidInboxStyle displays multiple short lines of text in the expanded notification view — ideal for email summaries, log feeds, or multi-item alerts.

using Plugin.LocalNotification.Core.Models;
using Plugin.LocalNotification.Core.Models.AndroidOption;

var notification = new NotificationRequest
{
    NotificationId = 200,
    Title = "3 new messages",
    Description = "Alice, Bob, Carol",
    Android =
    {
        Style = new AndroidInboxStyle
        {
            ContentTitle = "3 new messages",  // optional – overrides Title in expanded view
            SummaryText = "alice@example.com",
            Lines =
            [
                "Alice: Hey, are you free later?",
                "Bob: Don't forget the meeting at 3pm",
                "Carol: Sent you the report"
            ]
        }
    }
};
await LocalNotificationCenter.Current.Show(notification);

Properties

Property Type Description
Lines IList<string> Lines of text to show. Android renders up to ~5–7 lines.
ContentTitle string? Overrides the notification title in the expanded view.
SummaryText string? Footer text shown below the lines.

Messaging Style

AndroidMessagingStyle renders a conversation thread, with per-message sender names and timestamps. It is the recommended style for chat and messaging applications.

using Plugin.LocalNotification.Core.Models;
using Plugin.LocalNotification.Core.Models.AndroidOption;

var me = new AndroidStylePerson { Name = "Me" };
var alice = new AndroidStylePerson { Name = "Alice", Key = "user_alice" };

var notification = new NotificationRequest
{
    NotificationId = 201,
    Title = "Team Chat",
    Android =
    {
        Style = new AndroidMessagingStyle
        {
            Person = me,
            ConversationTitle = "Team Chat",
            IsGroupConversation = true,
            Messages =
            [
                new AndroidStyleMessage
                {
                    Text = "Good morning everyone!",
                    Person = alice,
                    Timestamp = DateTimeOffset.Now.AddMinutes(-5)
                },
                new AndroidStyleMessage
                {
                    Text = "Morning! Ready for the stand-up?",
                    Person = null, // null = sent by the local user (me)
                    Timestamp = DateTimeOffset.Now.AddMinutes(-2)
                }
            ]
        }
    }
};
await LocalNotificationCenter.Current.Show(notification);

Properties

Property Type Description
Person AndroidStylePerson The local user receiving the notification. Name is required.
ConversationTitle string? Title shown above the message thread (alias for ContentTitle).
IsGroupConversation bool Set true for group chats (sender name is shown per message).
Messages IList<AndroidStyleMessage> Messages in chronological order.

AndroidStylePerson

Property Type Description
Name string Display name (required).
Key string? Unique identifier used to deduplicate across notifications.
IsBot bool Whether this person is an automated agent.
IsImportant bool Mark as important (may bypass Do Not Disturb).

AndroidStyleMessage

Property Type Description
Text string Message body.
Timestamp DateTimeOffset When the message was sent.
Person AndroidStylePerson? Sender. null means the local user (the value of Person on the style).

Chronometer (Timer Display)

You can replace the notification's timestamp with a running stopwatch or countdown using the UsesChronometer and ChronometerCountDown properties on AndroidOptions. These work independently of the style classes.

var notification = new NotificationRequest
{
    NotificationId = 203,
    Title = "Workout Timer",
    Description = "Time elapsed",
    Android =
    {
        When = DateTimeOffset.Now,            // The reference point
        UsesChronometer = true,               // Show as running timer
        ChronometerCountDown = false          // Count up from When (true = count down to When)
    }
};
await LocalNotificationCenter.Current.Show(notification);

ChronometerCountDown requires Android API 24 (Android 7.0) or higher. On earlier API levels the property is silently ignored and the timer always counts up.


Colorized Background

Setting Colorized = true fills the notification background with the colour specified by AndroidOptions.Color. This is most visible on devices running Android 9+. It works best with Ongoing = true.

var notification = new NotificationRequest
{
    NotificationId = 204,
    Title = "Driving Mode",
    Android =
    {
        Color = new AndroidColor(unchecked((int)0xFF1976D2)), // Material Blue 700
        Colorized = true,
        Ongoing = true
    }
};
await LocalNotificationCenter.Current.Show(notification);

Default Behaviour (no style set)

When AndroidOptions.Style is null (the default), the plugin automatically chooses:

  • BigPicture style — when NotificationRequest.Image is set.
  • BigText style — when NotificationRequest.Description is non-empty (no image present).
  • No style — when both image and description are absent.

Audio Attributes (Sound Routing)

AndroidOptions.AudioAttributeUsage controls how Android classifies the notification sound, which determines which volume slider it follows and how it is routed on audio devices.

using Plugin.LocalNotification.Core.Models.AndroidOption;

var notification = new NotificationRequest
{
    NotificationId = 205,
    Title = "Alarm",
    Sound = "alarm_sound",
    Android =
    {
        AudioAttributeUsage = AndroidAudioAttributeUsage.Alarm
    }
};
await LocalNotificationCenter.Current.Show(notification);

On Android 8+ (API 26+) the sound is configured on the notification channel, so AudioAttributeUsage only affects devices running API 25 and below.

AndroidAudioAttributeUsage values

Value Description
Notification (default) Standard notification sound stream.
Alarm Alarm stream — follows the alarm volume slider.
NotificationRingtone Ringtone stream.
Media Media stream — follows the music volume slider.
VoiceCommunication Voice call stream.
Unknown Unknown / unmapped stream.

LED Notification Lighting

LedOnMs and LedOffMs on AndroidOptions control the LED blink pattern, combined with the LedColor ARGB value. These properties only apply on pre-API-26 devices.

var notification = new NotificationRequest
{
    NotificationId = 206,
    Title = "New message",
    Android =
    {
        LedColor = unchecked((int)0xFF00FF00), // green
        LedOnMs  = 300,   // LED on for 300 ms
        LedOffMs = 1000   // LED off for 1000 ms
    }
};
await LocalNotificationCenter.Current.Show(notification);

On Android 8+ (API 26+) the LED is configured per channel (EnableLights + LightColor on AndroidNotificationChannelRequest). The per-notification LedColor / LedOnMs / LedOffMs values are silently ignored by the OS on those devices.

Properties

Property Type Default Description
LedColor int? null ARGB colour for the LED. Values matching the AndroidColor helpers work here. null disables LED.
LedOnMs int? 300 Milliseconds the LED stays on during each blink. Used only when LedColor is set.
LedOffMs int? 1000 Milliseconds the LED is off during each blink. Used only when LedColor is set.

Clone this wiki locally