CanleyNotificationService

Namespace: Canley.Utility.Notifications
Type: Static Class

Overview

The CanleyNotificationService class is the central engine for the notifications suite. It bridges clean C# method calls to platform-native local notifications on iOS. Because it is a static class, it requires no scene setup and provides a single, high-performance entry point for managing local notification queues.

It is designed to be zero-dependency and editor-safe, allowing you to schedule, update, and inspect alerts seamlessly.


Setting Reference

Global configuration properties for the notification engine.

ClassMember (Syntax)Description
CanleyNotificationServiceUseUtcToggles whether calendar-based triggers evaluate against UTC or local device time.

Method Reference

Detailed documentation for core service methods.

ClassMethod (Syntax)Description
CanleyNotificationServiceInitialise()Requests alert, sound, and badge permissions from the OS.
CanleyNotificationServiceScheduleTimed(string, string, int, bool)Schedules a relative time-delay notification and returns its unique GUID.
CanleyNotificationServiceScheduleCalendar(…)Schedules an alert for a precise calendar date and time, returning its GUID.
CanleyNotificationServiceGetNotification(string)Retrieves a specific CanleyNotificationRecord struct by ID, or null if not found.
CanleyNotificationServiceGetAllNotifications()Returns a list of all currently scheduled notification records.
CanleyNotificationServiceUpdateTimed(…)Performs an upsert operation on an existing timed notification.
CanleyNotificationServiceUpdateCalendar(…)Performs an upsert operation on an existing calendar-based notification.
CanleyNotificationServiceRemoveNotification(string)Immediately cancels and removes a specific notification by its unique ID.
CanleyNotificationServiceClearAll()Performs a hard purge of the notification center, clearing all scheduled and delivered alerts.
CanleyNotificationServiceToSeconds(int, int, int, int)Helper utility to calculate total seconds from days, hours, minutes, and seconds.

Key Features

  • Zero-Dependency Core: Pure C# logic that interacts natively with the iOS Notification Center without bloating your project.
  • Editor-Safe Simulation: Provides non-intrusive console-based simulation on PC and Mac so you can debug your logic without pushing builds to physical hardware.
  • CRUD-Ready Architecture: Tracks notifications as records via unique IDs, letting you update, remove, or query active alerts at any time.
  • “Shadow” Update Logic: Upsert methods automatically check and purge stale alerts before registering new ones to prevent common duplicate notification bugs.

TIP

Always call CanleyNotificationService.Initialise() during your application’s initial boot sequence to ensure user permissions are requested cleanly before scheduling any delayed or calendar notifications.

4 items under this folder.