Skip to content

Notification Styles

levching edited this page Apr 15, 2020 · 3 revisions

A basic notification usually includes a title, a line of text, and one or more actions the user can perform in response. To provide even more information, you can also create large, expandable notifications by applying one of several notification templates as described on this page.

Add a large image

To add an image in your notification, pass an instance of AN_NotificationCompat.BigPictureStyle to SetStyle().

using SA.Android.App;
using SA.Android.SupportV4.App;
...

var builder = new AN_NotificationCompat.Builder();
builder.SetContentText("BigPictureStyle");
builder.SetContentTitle("BigPictureStyle title");
var bigPictureStyle = new AN_NotificationCompat.BigPictureStyle();

Texture2D bigPicture = GetBigPicture();
Texture2D largeIcon = BigLargeIcon();

bigPictureStyle.BigPicture(bigPicture);
bigPictureStyle.BigLargeIcon(largeIcon);
builder.SetStyle(bigPictureStyle);
builder.SetDefaults(AN_Notification.DEFAULT_ALL);

Add a large block of text

Apply AN_NotificationCompat.BigTextStyle to display text in the expanded content area of the notification:

using SA.Android.App;
using SA.Android.SupportV4.App;

...
var builder = new AN_NotificationCompat.Builder();
builder.SetContentText("BigTextStyle");
builder.SetContentTitle("BigTextStyle Title");

var bigTextStyle = new AN_NotificationCompat.BigTextStyle();
bigTextStyle.BigText("This is test big text style");
builder.SetStyle(bigTextStyle);
builder.SetDefaults(AN_Notification.DEFAULT_ALL);
Clone this wiki locally