Request Notification Permission
const granted = await this.reteno.requestNotificationPermission();
console.log('Permission result:', granted);Get Initial Notification
const initial = await this.reteno.getInitialNotification();
console.log('Initial push payload:', initial);Listen for Received Push
const onPushReceived = (event: any) => {
console.log('reteno-push-received', event);
};
this.reteno.setOnRetenoPushReceivedListener(onPushReceived);
// later
this.reteno.removeOnRetenoPushReceivedListener(onPushReceived);Listen for Notification Click
const onClicked = (event: any) => {
console.log('reteno-notification-clicked', event);
};
this.reteno.setOnRetenoNotificationClickedListener(onClicked);
// later
this.reteno.removeOnRetenoNotificationClickedListener(onClicked);Android-only Listeners
const onDismissed = (payload: any) => console.log('Push dismissed', payload);
const onCustomReceived = (payload: any) => console.log('Custom push received', payload);
this.reteno.setOnRetenoPushDismissedListener(onDismissed);
this.reteno.setOnRetenoCustomPushReceivedListener(onCustomReceived);
// later
this.reteno.removeOnRetenoPushDismissedListener(onDismissed);
this.reteno.removeOnRetenoCustomPushReceivedListener(onCustomReceived);iOS Foreground/Tap Handlers (optional)
These methods are iOS-only. On Android they are not implemented and calls return an error (Promise reject / error callback).
await this.reteno.setWillPresentNotificationOptions({
options: ['badge', 'sound', 'banner'],
emitEvent: true,
});
await this.reteno.setDidReceiveNotificationResponseHandler({
enabled: true,
emitEvent: true,
});options accepts any combination of NotificationPresentationOption values: 'badge' | 'sound' | 'alert' | 'banner' | 'list'.
Shorthand forms accepted by setWillPresentNotificationOptions:
// Pass only the options array
await this.reteno.setWillPresentNotificationOptions(['badge', 'sound', 'banner']);
// Clear previously set options
await this.reteno.setWillPresentNotificationOptions(null);setDidReceiveNotificationResponseHandler also accepts boolean | null to disable or clear the handler:
await this.reteno.setDidReceiveNotificationResponseHandler(false);If emitEvent: true, plugin emits JS events:
reteno-push-receivedreteno-notification-clicked
Pass Token Manually
await this.reteno.setDeviceToken(token);Use this when token callbacks are handled outside cordova-plugin-reteno (for example, by another plugin/SDK that owns APNs/FCM token delivery).
Android Default Channel Update
await this.reteno.updateDefaultNotificationChannel({
name: 'New Channel Name',
description: 'New Channel Description',
});