Files
daily-notification-plugin/doc/GETTING_STARTED.md

3.7 KiB

Getting Started

Purpose: Step-by-step installation and setup guide for Daily Notification Plugin.
Owner: Development Team
Last Updated: 2025-12-22
Status: active


Installation

npm

npm install @timesafari/daily-notification-plugin

yarn

yarn add @timesafari/daily-notification-plugin

pnpm

pnpm add @timesafari/daily-notification-plugin

Platform Setup

iOS

  1. Add to Info.plist:
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
  <string>org.timesafari.dailynotification.fetch</string>
</array>
  1. Register background task in AppDelegate.swift:
import BackgroundTasks

func application(_ application: UIApplication, 
                didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  BGTaskScheduler.shared.register(forTaskWithIdentifier: "org.timesafari.dailynotification.fetch", 
                                  using: nil) { task in
    // Handle background fetch task
  }
  return true
}

Android

  1. Add permissions to AndroidManifest.xml:
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />

Note on USE_EXACT_ALARM: The USE_EXACT_ALARM permission is restricted by Google on Android. Apps that declare it must be primarily dedicated to alarm or calendar functionality. Google will reject apps from the Play Store that use this permission for other purposes. This plugin uses SCHEDULE_EXACT_ALARM instead, which is sufficient for scheduling daily notifications.

  1. Register WorkManager in Application.kt:
import androidx.work.Configuration
import androidx.work.WorkManager

class MyApplication : Application() {
  override fun onCreate() {
    super.onCreate()
    WorkManager.initialize(
      this,
      Configuration.Builder()
        .setMinimumLoggingLevel(android.util.Log.INFO)
        .build()
    )
  }
}

Basic Usage

1. Import the Plugin

import { DailyNotification } from '@timesafari/daily-notification-plugin';

2. Request Permission

const { state } = await DailyNotification.requestPermission();
if (state !== 'granted') {
  console.error('Notification permission denied');
  return;
}

3. Create a Schedule

const { schedule } = await DailyNotification.createSchedule({
  id: 'morning-notification',
  kind: 'notify',
  clockTime: '09:00',
  enabled: true
});

4. Verify Schedule

const { schedules } = await DailyNotification.getSchedules();
console.log('Active schedules:', schedules);

Next Steps


Authoritative Documentation


Support

For issues, questions, or contributions:

  1. Check Troubleshooting Guide
  2. Review System Invariants
  3. Check Progress Documentation for current status

See also: