0.0.21 ā€¢ Published 10 months ago

@exxili/capacitor-ios-background-push v0.0.21

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@exxili/capacitor-ios-background-push

šŸš§ Alpha Release - Work in Progress Note: The plugin is currently working, Still work in progress - as/when i get time i will update this to include tests

Please note that this plugin is currently under active development and may be subject to changes or updates.

A Capacitor plugin designed to handle iOS Silent Push notifications, enabling background updates, processing, and seamless integration with standard push notifications.

āš ļø iOS-specific Support

This plugin is specifically designed for iOS and does not support Android. It handles Silent Push notifications on iOS devices, providing a seamless integration with standard push notifications.

šŸš€ Getting Started

Follow the steps below to integrate the plugin into your Capacitor project:

  1. Install the plugin using npm:
npm install @exxili/capacitor-ios-background-push
  1. Sync your Capacitor project:
npx cap sync
  1. Import the plugin in your project and use it to listen for remote notifications:

import { IOSBackgroundPush } from '@exxili/capacitor-ios-background-push';

// Add a listener for silent push notifications
IOSBackgroundPush.addListener('SilentNotificationReceived', (data) => {
  console.log('Silent push notification received:', data);
});
  1. Update your AppDelegate.swift file in your iOS project to handle Silent Push notifications. Add the following method to your AppDelegate class:
import UIKit
import Capacitor
import ExxiliCapacitorIosBackgroundPush

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    // ... other existing code ...

    func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
        NotificationCenter.default.post(name: .didReceiveRemoteNotificationForIOSBackgroundPush, object: nil, userInfo: [
            "userInfo": userInfo,
            "completionHandler": completionHandler
        ])
    }
}

API

addListener('SilentNotificationReceived', ...)

addListener(eventName: 'SilentNotificationReceived', listenerFunc: (data: { data: any; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Called when a silent push notification is received.

ParamType
eventName'SilentNotificationReceived'
listenerFunc(data: { data: any; }) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


Interfaces

PluginListenerHandle

PropType
remove() => Promise<void>
0.0.21

10 months ago

0.0.20

1 year ago

0.0.19

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago