Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70432

Capacitor API Push Notifications methods in documentation not available

$
0
0

@t4tapas wrote:

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;
  1. Method requestPermission is not a valid method instead I am able to get method requestPermissions which returns an Array of type any. In android, it is returning undefined.

  2. 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;
}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70432

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>