Creates a new event emitter instance.
Synchronously calls all of the listeners attached to that specific event. The event can include any number of arguments that will be passed to the listeners.
Get the list of UnifiedPush distributors available on the device. The list will always include a low-priority distributor that uses Firebase Cloud Messaging (FCM).
a list of distributor identifiers.
Register a device for push notifications, connecting to the selected distributor.
The returned promise will automatically be rejected if app is running inside an emulator or no distributor is selected. If you had already registered your device with a distributor, this ensures the connection is working, hence why you should always call this method on application startup. External distributors will be favored over embedded distributors.
The VAPID public key that identifies the server that will be sending the push notifications. This key can be generated using the web-push
package from npm. More information can be found at https://github.com/web-push-libs/web-push.
Optional
instance: stringThis param is used to identify different registrations in the same device, for example if the app has an account swithcer feature, you can set this to the current user ID. This param is not mandatory. If you won't have multiple users on the same device at the same time, you can omit it.
Select a distributor for using UnifiedPush. This will be saved in the device storage.
You can also pass null
to clear the saved distributor, but this will clear all instances registered with the distributor.
The distributor identifier to select.
Optional
startFunction that is automatically invoked when the first listener for an event with the given name is added. Override it in a subclass to perform some additional setup once the event started being observed.
Optional
stopFunction that is automatically invoked when the last listener for an event with the given name is removed. Override it in a subclass to perform some additional cleanup once the event is no longer observed.
Unregister a device for push notifications.
This method will remove a registration for a specific instance from the distributor.
The distributor subscriber will not receive the unregistered
event after calling this method.
Optional
instance: stringThe same instance
param that was used on the registerDevice
method.
The native module that is used to bridge the kotlin native code with the javascript code.