Detailed Member Reference

Namespace: Canley.Utility.Notifications
Class: CanleyNotificationService

UseUtc

public static bool UseUtc = true;
  • Description: A global master configuration property that determines whether calendar-based notifications are evaluated against absolute Coordinated Universal Time (UTC) or the local device’s wall-clock time.
  • Workflow:
    1. Global Check: When any calendar scheduling method (ScheduleCalendar or UpdateCalendar) runs, it reads this property to determine which timezone context to feed into the operating system’s native trigger logic.
    2. Flexible Toggling: Because it is a public static variable, you can configure it once during your application boot sequence, or flip it dynamically on a case-by-case basis before firing specific scheduling calls.
  • Property Type: bool (Default: true)
  • Access: Read/Write

NOTE

Setting UseUtc affects all subsequent calendar scheduling calls until it is changed again. If your application mixes global server-time events with local player-time reminders, make sure you explicitly set the property right before calling your scheduling methods to avoid timezone mix-ups.

  • Example:
using Canley.Utility.Notifications;
using UnityEngine;
 
public class NotificationContextManager : MonoBehaviour 
{
    public void ScheduleTimedEvents()
    {
        // 1. Global event: Use UTC so the competition starts simultaneously worldwide
        CanleyNotificationService.UseUtc = true;
        CanleyNotificationService.ScheduleCalendar(
            "Global Championship",
            "The arena doors are open!",
            2026, 8, 1, 12, 0, 0, // Aug 1, 2026 at 12:00 UTC
            false
        );
 
        // 2. Local reminder: Toggle off UTC to target local device wall-clock time
        CanleyNotificationService.UseUtc = false;
        CanleyNotificationService.ScheduleCalendar(
            "Morning Harvest",
            "Good morning buddy! Don't forget to collect your crops!",
            null, null, null, // Daily trigger ignoring date
            8, 0, 0,          // Local time 8:00 AM sharp
            true              // Repeats daily
        );
 
        // 3. Reset back to the global default for subsequent code paths
        CanleyNotificationService.UseUtc = true;
    }
}

TIP

This property is brilliant for handling player-centric habits versus globally synchronized events. Use UseUtc = true for multiplayer events or global updates, and UseUtc = false when you want notifications to respect daylight saving time or local morning routines on the player’s handset.

Example case: My TrackMyMeds app uses notifications to remind users when to take their medication. I set UseUtc = false. That way, if they enter or leave daylight savings, or change timezones, their reminders will automatically adjust to their new local time.