subscribe method

Future<String?> subscribe(
  1. String liveNotificationId
)

Subscribe this device to a live notification

The device must already be a registered push subscriber — call PushpushgoSdk.registerForNotifications() first.

From this point on the backend drives everything: it pushes start, update and end events, and the native SDK renders them. If the activity is already running when the device subscribes, its current state is rendered right away.

Returns the backend subscriber id on Android, null on iOS (where the registration is keyed by an internal installation id).

Implementation

Future<String?> subscribe(String liveNotificationId) async {
  _checkInitialized();

  try {
    return await LiveActivitiesChannel.invokeMethod<String>(
      method: LiveActivityMethod.subscribe,
      arguments: {'liveNotificationId': liveNotificationId},
    );
  } catch (e) {
    log('PPGLiveActivities: subscribe failed - $e');
    rethrow;
  }
}