Notifications API

Schedule reminders, re-engagement prompts, and timed events using local notifications. The host persists schedules and surfaces alerts even when your game is suspended.

Quick Start

import RundotGameAPI from '@series-inc/rundot-game-sdk/api'

// Schedule a notification for one hour from now
const id = await RundotGameAPI.notifications.scheduleAsync(
  'Daily Reward Ready',
  'Come back to claim your chest!',
  60 * 60, // fire in one hour (seconds)
)

// Cancel a scheduled notification
await RundotGameAPI.notifications.cancelNotification(id)

// Get all pending notifications
const pending = await RundotGameAPI.notifications.getAllScheduledLocalNotifications()

Use Cases

Energy Refills

Events Starting

Building Complete

Daily Rewards

Advanced Scheduling

Managing Notifications

Deeplinking

When a user taps a notification, they're taken directly to your game by default. Use RundotGameAPI.context.launchParams to detect if the app was launched from a notification and handle accordingly.

API Reference

Method
Returns
Description

scheduleAsync(title, body, delaySeconds, id?, options?)

Promise<string>

Schedule a notification

cancelNotification(id)

Promise<void>

Cancel a scheduled notification

getAllScheduledLocalNotifications()

Promise<Notification[]>

Get all pending notifications

isLocalNotificationsEnabled()

Promise<boolean>

Check if notifications are enabled

setLocalNotificationsEnabled(enabled)

Promise<void>

Enable or disable notifications

Best Practices

  • Keep payloads small—store heavy data in your own backend and reference it by ID.

  • Throttle notifications; over-scheduling increases opt-outs and host-level throttling.

  • Cancel reminders when players complete the associated task to avoid confusing messaging.

  • Use meaningful custom IDs to dedupe notifications (e.g., energy_refill, daily_reward).

  • Batch maintenance: iterate through getAllScheduledLocalNotifications() to tidy queues during logout.

Last updated