I am using Capacitor Push Notifications API but there are few mismatches with the document provided.
I am using the API as guided.
import {
Plugins,
PluginListenerHandle,
PushNotification,
PushNotificationToken,
PushNotificationActionPerformed
} from '@capacitor/core';
const { PushNotifications } = Plugins;
-
Method
requestPermission
is not a valid method instead I am able to get methodrequestPermissions
which returns an Array of type any. In android, it is returning undefined. -
Method
removeAllListeners
is not a valid method
Is the official document updated?
Only the following methods are available in core-plugin-definations.d.ts when I am looking for in the source.
export interface PushNotificationsPlugin extends Plugin {
register(): Promise<void>;
getDeliveredNotifications(): Promise<PushNotificationDeliveredList>;
removeDeliveredNotifications(delivered: PushNotificationDeliveredList): Promise<void>;
removeAllDeliveredNotifications(): Promise<void>;
createChannel(channel: PushNotificationChannel): Promise<void>;
deleteChannel(channel: PushNotificationChannel): Promise<void>;
listChannels(): Promise<PushNotificationChannelList>;
addListener(eventName: 'registration', listenerFunc: (token: PushNotificationToken) => void): PluginListenerHandle;
addListener(eventName: 'registrationError', listenerFunc: (error: any) => void): PluginListenerHandle;
addListener(eventName: 'pushNotificationReceived', listenerFunc: (notification: PushNotification) => void): PluginListenerHandle;
addListener(eventName: 'pushNotificationActionPerformed', listenerFunc: (notification: PushNotificationActionPerformed) => void): PluginListenerHandle;
}