Interface Push

Enables a device to be registered and deregistered from receiving push notifications.

Hierarchy

  • Push

Properties

Methods

Properties

admin: PushAdmin

A PushAdmin object.

Methods

  • Activates the device for push notifications. Subsequently registers the device with Ably and stores the deviceIdentityToken in local storage.

    Parameters

    • Optional registerCallback: RegisterCallback

      A function passed to override the default implementation to register the local device for push activation.

    • Optional updateFailedCallback: ErrorCallback

      A callback to be invoked when the device registration failed to update.

    Returns Promise<void>

  • Deactivates the device from receiving push notifications.

    Parameters

    • Optional deregisterCallback: DeregisterCallback

      A function passed to override the default implementation to deregister the local device for push activation.

    Returns Promise<void>

  • Updates the device's push token after the underlying push platform has rotated it, and synchronizes the new token with Ably by updating the device registration. Call this from your platform's token refresh listener, for example messaging().onTokenRefresh() of @react-native-firebase/messaging, once activate() has completed.

    The synchronization with Ably is fire-and-forget: it is serialized with any in-flight activate(), deactivate() or earlier updateToken() synchronization rather than racing it, it is routed through the registerCallback passed to activate() when one was provided, and a synchronization failure is reported to the updateFailedCallback passed to activate().

    Parameters

    • token: PushDeviceToken

      The refreshed push token, in the same shape as returned by the requestToken callback of the ably/react-native-push plugin.

    Returns Promise<void>

    A promise which resolves once the refreshed token has been persisted locally and its synchronization with Ably has been initiated, and rejects if the token is malformed or the device is not activated for push notifications.

Generated using TypeDoc