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);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();