Request Notification Permission
RetenoPlugin.requestNotificationPermission()
.then((result) => {
// Android: 1 granted / 0 declined
console.log('Permission result:', result);
})
.catch((err) => console.error(err));Get Initial Notification
When app starts from push tap, get payload with getInitialNotification():
RetenoPlugin.getInitialNotification()
.then((data) => console.log('getInitialNotification', data))
.catch((err) => console.error('getInitialNotification: ERROR', err));Listen for Received Push while App Is Active
function onPushReceived(event) {
console.log('reteno-push-received:', event);
}
RetenoPlugin.setOnRetenoPushReceivedListener(onPushReceived);
// later
RetenoPlugin.removeOnRetenoPushReceivedListener(onPushReceived);Listen for Push Click Events
function onNotificationClicked(event) {
console.log('reteno-notification-clicked:', event);
}
RetenoPlugin.setOnRetenoNotificationClickedListener(onNotificationClicked);
// later
RetenoPlugin.removeOnRetenoNotificationClickedListener(onNotificationClicked);Android-only Listeners
function onDismissed(payload) {
console.log('Push dismissed', payload);
}
function onCustomReceived(payload) {
console.log('Custom push received', payload);
}
RetenoPlugin.setOnRetenoPushDismissedListener(onDismissed);
RetenoPlugin.setOnRetenoCustomPushReceivedListener(onCustomReceived);
// later
RetenoPlugin.removeOnRetenoPushDismissedListener(onDismissed);
RetenoPlugin.removeOnRetenoCustomPushReceivedListener(onCustomReceived);iOS Foreground/Tap Handlers (optional)
These methods are iOS-only. On Android they are not implemented and calls will fail.
await RetenoPlugin.setWillPresentNotificationOptions({
options: ['badge', 'sound', 'banner'],
emitEvent: true,
});
await RetenoPlugin.setDidReceiveNotificationResponseHandler({
enabled: true,
emitEvent: true,
});If emitEvent: true, plugin emits JS events:
reteno-push-receivedreteno-notification-clicked
Pass Token Manually (if another plugin gets it)
await RetenoPlugin.setDeviceToken(token);Use this when token callbacks are handled outside cordova-plugin-reteno.
Android Default Notification Channel Update
RetenoPlugin.updateDefaultNotificationChannel({
name: 'New Channel Name',
description: 'New Channel Description',
})
.then(() => console.log('updateDefaultNotificationChannel: OK'))
.catch((err) => console.error('updateDefaultNotificationChannel: ERROR', err));