capacitor-call-alert
v0.0.3
Published
A Capacitor plugin for showing call alerts and notifications in your mobile applications
Maintainers
Readme
Capacitor Call Alert
A Capacitor plugin for showing call alerts and notifications in your mobile applications.
Installation
npm install capacitor-call-alert
npx cap syncUsage
import { CallAlert } from 'capacitor-call-alert';
// Show a call alert
await CallAlert.showCallAlert({
caller: 'John Doe',
duration: 30000, // Optional: duration in milliseconds
priority: 'high', // Optional: 'high' | 'normal' | 'low'
sound: true, // Optional: enable/disable sound
vibration: true // Optional: enable/disable vibration
});
// Dismiss the current call alert
await CallAlert.dismissCallAlert();API
showCallAlert(options: CallAlertOptions)
Shows a call alert notification with the specified options.
Options
| Option | Type | Required | Description | |--------|------|----------|-------------| | caller | string | Yes | The name or identifier of the caller | | duration | number | No | Duration in milliseconds before auto-dismissing | | priority | 'high' | 'normal' | 'low' | No | Alert priority level | | sound | boolean | No | Whether to play a sound (default: true) | | vibration | boolean | No | Whether to vibrate (default: true) |
dismissCallAlert()
Dismisses the current call alert if one is active.
Platform Support
- iOS
- Android
- Web
Permissions
iOS
Add the following to your Info.plist:
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>Android
Add the following to your AndroidManifest.xml:
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />License
MIT
