1.0.12 • Published 3 years ago

@mfbhatt/azure-push-notifications v1.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

push-notifications

The Push Notifications API provides access to native push notifications for Capacitor.

Install

npm install @mfbhatt/push-notifications
npx cap sync

Example

import {
  AzurePushNotifications,
  AzurePushNotificationSchema,
  PushNotificationActionPerformed,
  PushNotificationToken,
} from '@mfbhatt/azure-push-notifications';

Usage

AzurePushNotifications.requestPermissions().then((result) => {
      AzurePushNotifications.register({
        notificationHubName: '<AZURE NOTIFICATION HUB NAME>',
        connectionString:
          '<AZURE NOTIFICATION CONNECTION STRING>',
        deviceTag: '<DEVICE TAG>',
      }).then(() => {
        AzurePushNotifications.addListener(
          'registration',
          (token: PushNotificationToken) => {
            alert('Push registration success, token: ' + token.value);
          }
        );
      });
    });

Listners

AzurePushNotifications.addListener(
          'registrationError',
          (error: any) => {
            alert('Error on registration: ' + JSON.stringify(error));
          }
        );

        AzurePushNotifications.addListener(
          'pushNotificationReceived',
          (notification: AzurePushNotificationSchema) => {
            alert('Push received: ' + JSON.stringify(notification));
          }
        );
        AzurePushNotifications.addListener(
          'pushNotificationActionPerformed',
          (notification: PushNotificationActionPerformed) => {
            alert('Push action performed: ' + JSON.stringify(notification));
          }
        );
1.0.11

3 years ago

1.0.10

3 years ago

1.0.12

3 years ago

1.0.4

3 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago