9994db28bd1738c4c3b530b13d36358cb88001f7
Daily Notification Plugin for Capacitor
A Capacitor plugin for scheduling and managing daily notifications with advanced features and robust error handling.
Features
- Schedule daily notifications with custom time and content
- Support for different priority levels
- Timezone-aware scheduling
- Offline support with caching
- Comprehensive permission handling
- Automatic retry logic
- Detailed notification status tracking
- Configurable settings management
Installation
npm install daily-notification-plugin
npx cap sync
iOS Setup
No additional setup required for iOS. The plugin automatically handles all necessary configurations.
Usage
Basic Usage
import { DailyNotification } from 'daily-notification-plugin';
// Schedule a daily notification
await DailyNotification.scheduleDailyNotification({
url: 'https://api.example.com/updates',
time: '09:00',
title: 'Daily Update',
body: 'Your daily update is ready'
});
Advanced Features
Custom Priority
await DailyNotification.scheduleDailyNotification({
url: 'https://api.example.com/updates',
time: '09:00',
priority: 'high'
});
Timezone Support
await DailyNotification.scheduleDailyNotification({
url: 'https://api.example.com/updates',
time: '09:00',
timezone: 'America/New_York'
});
Check Notification Status
const status = await DailyNotification.getNotificationStatus();
console.log('Notification status:', status);
Update Settings
await DailyNotification.updateSettings({
sound: true,
priority: 'high',
timezone: 'America/Los_Angeles'
});
API Documentation
Methods
scheduleDailyNotification(options: ScheduleOptions)
Schedule a new daily notification.
getLastNotification()
Get information about the last delivered notification.
cancelAllNotifications()
Cancel all pending notifications.
getNotificationStatus()
Get current notification status and settings.
updateSettings(settings: NotificationSettings)
Update notification settings.
checkPermissions()
Check current notification permissions.
requestPermissions()
Request notification permissions.
Types
interface ScheduleOptions {
url: string;
time: string;
title?: string;
body?: string;
sound?: boolean;
priority?: 'high' | 'default' | 'low';
timezone?: string;
}
interface NotificationSettings {
sound?: boolean;
priority?: string;
timezone?: string;
}
Error Handling
The plugin provides detailed error messages for various scenarios:
- Invalid parameters
- Permission issues
- Scheduling failures
- Invalid time formats
- Invalid timezone identifiers
- Invalid priority values
Contributing
Contributions are welcome! Please read our contributing guidelines and submit pull requests to our GitHub repository.
License
MIT License - see LICENSE file for details
Description
Languages
Java
48.3%
TypeScript
19%
Swift
9.2%
Kotlin
9.1%
Vue
4.8%
Other
9.6%