Skip to content

Platform Specific

Shiny provides platform-specific notification and channel classes that extend the base types with additional capabilities. Use AndroidNotification / AndroidChannel on Android and AppleNotification / AppleChannel on iOS for full platform control.

Extends Notification with Android-specific display and behavior options.

await notifications.Send(new AndroidNotification
{
Title = "Download Complete",
Message = "Your file has been downloaded",
Channel = "downloads",
AutoCancel = true,
UseBigTextStyle = true,
SmallIconResourceName = "ic_download",
LargeIconResourceName = "ic_download_large",
ColorResourceName = "colorPrimary",
Category = "progress"
});
PropertyTypeDefaultDescription
AutoCancelbooltrueDismiss notification when tapped
OnGoingboolfalsePersistent notification that cannot be swiped away
UseBigTextStyleboolfalseUse expanded text style for long messages
SmallIconResourceNamestring?nullAndroid resource name for the small icon
LargeIconResourceNamestring?nullAndroid resource name for the large icon
ColorResourceNamestring?nullAndroid resource name for the accent color
Categorystring?nullNotification category (e.g. "alarm", "email", "progress")
Tickerstring?nullTicker text shown briefly in the status bar
LaunchActivityTypeType?nullSpecific activity to launch when tapped
LaunchActivityFlagsActivityFlagsNewTask | ClearTaskIntent flags for the launch activity

Extends Channel with Android notification channel settings. These map directly to Android’s NotificationChannel API.

notifications.AddChannel(new AndroidChannel
{
Identifier = "alerts",
Description = "Important alerts",
Importance = ChannelImportance.High,
EnableVibration = true,
EnableLights = true,
ShowBadge = true,
BypassDnd = false,
LockscreenVisibility = NotificationVisibility.Public
});
PropertyTypeDefaultDescription
AllowBubblesbool?nullAllow bubble notifications
ShowBadgebool?nullShow badge on app icon for this channel
EnableLightsbool?nullEnable LED indicator
EnableVibrationbool?nullEnable vibration
BypassDndbool?nullBypass Do Not Disturb mode
LockscreenVisibilityNotificationVisibility?nullVisibility on the lock screen
ValueDescription
PublicFull notification content shown on lock screen
PrivateIcon shown but content hidden on lock screen
SecretNotification not shown on lock screen at all

Extends Notification with iOS-specific features including subtitles, media attachments, and relevance scoring.

await notifications.Send(new AppleNotification
{
Title = "New Photo",
Subtitle = "From John",
Message = "Check out this sunset!",
Channel = "photos",
RelevanceScore = 0.8,
TargetContentIdentifier = "photo-123",
FilterCriteria = "photos"
});
PropertyTypeDefaultDescription
Subtitlestring?nullAdditional subtitle text displayed below the title
RelevanceScoredouble0.0Relevance score (0.0 to 1.0) for notification summary ranking
FilterCriteriastring?nullCriteria for filtering in Notification Service Extensions
TargetContentIdentifierstring?nullIdentifier for the content the notification references
AttachmentsUNNotificationAttachment[]nullMedia attachments (images, audio, video)

Extends Channel with iOS-specific category options.

notifications.AddChannel(new AppleChannel
{
Identifier = "messages",
Description = "Chat messages",
Importance = ChannelImportance.High,
IntentIdentifiers = new[] { "INSendMessageIntent" },
CategoryOptions = UNNotificationCategoryOptions.CustomDismissAction
});
PropertyTypeDefaultDescription
IntentIdentifiersstring[]?nullSiriKit intent identifiers for this category
CategoryOptionsUNNotificationCategoryOptionsNoneCategory behavior options
ValueDescription
NoneNo special behavior
CustomDismissActionSend dismiss actions to your app
AllowInCarPlayShow notifications in CarPlay
HiddenPreviewsShowTitleShow title even when previews are hidden
HiddenPreviewsShowSubtitleShow subtitle even when previews are hidden
AllowAnnouncementAllow Siri to announce notifications

Use #if directives to provide platform-specific configuration while keeping shared logic.

Notification notification;
#if ANDROID
notification = new AndroidNotification
{
Title = "Update Available",
Message = "A new version is ready to install",
Channel = "updates",
SmallIconResourceName = "ic_update",
UseBigTextStyle = true
};
#elif IOS
notification = new AppleNotification
{
Title = "Update Available",
Subtitle = "Version 2.0",
Message = "A new version is ready to install",
Channel = "updates",
RelevanceScore = 0.5
};
#else
notification = new Notification
{
Title = "Update Available",
Message = "A new version is ready to install",
Channel = "updates"
};
#endif
await notifications.Send(notification);