Register push device

Generated reference for ovok_sdk: register push device.

  • Stable unknown
  • Release candidate not available
  • Development since 0.2.0-dev.51+80996d9

PushDeviceUnsubscribe

typedef PushDeviceUnsubscribe = Future<void> Function()

Stops re-registering on token refresh and removes the device from Ovok, so it gets no more push.

registerPushDevice

Future<PushDeviceUnsubscribe> registerPushDevice(Ovok ovok, {required Future<String?> Function() token, required Stream<String> onTokenRefresh, required String platform, String? appId})

Registers this device for push to the signed-in person, and registers it again whenever its token changes.

The app supplies its own token source, such as firebase_messaging: token reads the current token and onTokenRefresh emits each new one. platform is ios, android or web; appId is the app's bundle or package id. Ask for notification permission first, and call it after sign-in.

Throws a StateError when token has no token yet. Completes with a function that stops listening for token changes and removes the device from Ovok; call it on sign-out, before the session ends.

ParameterTypeKindDefault
ovokOvokpositional
tokenFuture<String?> Function()required named
onTokenRefreshStream<String>required named
platformStringrequired named
appIdString?named

Last updated on

On this page