Channels
Overview
Section titled “Overview”Channels group notifications by type and control their behavior (sound, importance, actions). On Android, channels map directly to system notification channels. On iOS, Shiny manages channels internally.
Channel Properties
Section titled “Channel Properties”| Property | Type | Default | Description |
|---|---|---|---|
Identifier |
string |
required | Unique channel ID |
Description |
string? |
null |
Human-readable description |
Importance |
ChannelImportance |
Normal |
Priority level |
Sound |
ChannelSound |
Default |
Sound setting |
CustomSoundPath |
string? |
null |
Path for custom sounds |
Actions |
List<ChannelAction> |
empty | Action buttons |
Default Channel
Section titled “Default Channel”Shiny provides a built-in default channel.
var defaultChannel = Channel.Default;// Identifier: "Notifications", Importance: LowCreating Channels
Section titled “Creating Channels”INotificationManager notifications; // injected
// Simple channelnotifications.AddChannel(new Channel{ Identifier = "orders", Description = "Order notifications", Importance = ChannelImportance.High, Sound = ChannelSound.Default});
// Channel with action buttonsvar channel = Channel.Create("messages", ChannelAction.Create("reply", "Reply", ChannelActionType.TextReply), ChannelAction.Create("dismiss", "Dismiss", ChannelActionType.Destructive));notifications.AddChannel(channel);ChannelImportance
Section titled “ChannelImportance”| Value | Description |
|---|---|
Low |
No sound, minimal visual |
Normal |
Default sound and visual |
High |
Sound, may peek on screen |
Critical |
Urgent, may override DND |
ChannelSound
Section titled “ChannelSound”| Value | Description |
|---|---|
None |
Silent |
Default |
System default sound |
High |
High-priority sound |
Custom |
Custom sound file (set CustomSoundPath) |
Channel Actions
Section titled “Channel Actions”Action buttons appear on the notification, allowing quick interaction.
// Text reply actionChannelAction.Create("reply", "Reply", ChannelActionType.TextReply);
// Destructive action (red on iOS)ChannelAction.Create("delete", "Delete", ChannelActionType.Destructive);
// Opens the appChannelAction.Create("open", "View", ChannelActionType.OpenApp);
// Default (no special behavior)ChannelAction.Create("ack", "OK", ChannelActionType.None);Requiring an unlock
Section titled “Requiring an unlock”An action runs straight from the lock screen by default. For an action with a real-world effect, such as “Close Garage” or “Disarm”, set RequiresUnlock. The user has to unlock the device before the action reaches your INotificationDelegate, and the app is not brought to the foreground. It combines with any action type.
var channel = Channel.Create("garage", ChannelAction.Create("close", "Close Garage", ChannelActionType.None, requiresUnlock: true), ChannelAction.Create("ignore", "Ignore"));notifications.AddChannel(channel);| Platform | Behavior |
|---|---|
| iOS / Mac Catalyst / macOS | UNNotificationActionOptions.AuthenticationRequired |
| Android 12+ (API 31) | NotificationCompat.Action.Builder.setAuthenticationRequired(true) |
| Android 11 and below | Not supported - the action runs without prompting |
| Windows / Linux | Ignored |
Managing Channels
Section titled “Managing Channels”// Get a specific channelvar channel = notifications.GetChannel("orders");
// Get all channelsvar channels = notifications.GetChannels();
// Remove a channelnotifications.RemoveChannel("orders");
// Clear all channelsnotifications.ClearChannels();

