Detailed Member Reference

Namespace: Canley.Utility.Notifications
Class: CanleyNotificationService

ScheduleTimed

public static string ScheduleTimed(string title, string body, int seconds, bool repeats = false)
  • Description: Schedules a notification to trigger after a specific duration of time.
  • Parameters:
    • title (string): The header text of the notification banner.
    • body (string): The primary message content shown to the user.
    • seconds (int): The duration in seconds until the alert triggers.
    • repeats (bool, optional): A flag determining whether the notification should trigger periodically (default: false).

NOTE

You may use the ToSeconds() helper method for easy time units conversion.

  • Workflow:

    1. ID Generation: Automatically assigns a unique GUID to the scheduled notification.
    2. Platform Routing: Dispatches the payload to the native iOS notification queue or simulates the event in the Unity Editor console.
  • Return Type: string (Returns the assigned unique GUID string handle, which should be stored if you intend to update or cancel the notification later).

  • Access: Public Static

  • Example:

using Canley.Utility.Notifications;
using UnityEngine;
 
public class GameRewardSystem : MonoBehaviour 
{
    private string _activeRewardId;
 
    public void ScheduleDailyChest() 
    {
        // Schedule a notification to fire in 1 hour (3600 seconds)
        _activeRewardId = CanleyNotificationService.ScheduleTimed(
            "Energy Refilled",
            "Your energy has fully recharged!",
            CanleyNotificationService.ToSeconds(hours: 1),
            false
        );
 
        Debug.Log($"Scheduled reward notification with ID: {_activeRewardId}");
    }
}

TIP

Always pair ScheduleTimed with CanleyNotificationService.ToSeconds() when dealing with larger time increments like hours or days. It keeps your code readable and eliminates manual calculation errors.