initialize method

Future<void> initialize({
  1. String? appGroupId,
  2. bool isProduction = true,
  3. bool isDebug = false,
})

Initialize Live Activities support

Call this after PushpushgoSdk.initialize() — the API key and project id are taken from the main SDK configuration.

Parameters:

  • appGroupId: iOS only, required there. App Group shared between the app and its Widget Extension (e.g. group.com.your.app.liveactivities). Team badges and hot-message state are persisted there. Ignored on Android.
  • isProduction: Use production environment (default: true)
  • isDebug: Enable debug logging (default: false)

Implementation

Future<void> initialize({
  String? appGroupId,
  bool isProduction = true,
  bool isDebug = false,
}) async {
  if (_isInitialized) {
    log('PPGLiveActivities: Already initialized');
    return;
  }

  try {
    await LiveActivitiesChannel.invokeMethod<void>(
      method: LiveActivityMethod.initialize,
      arguments: {
        'appGroupId': appGroupId,
        'isProduction': isProduction,
        'isDebug': isDebug,
      },
    );
    _isInitialized = true;
    _setupEventListening();
    log('PPGLiveActivities: Initialized successfully');
  } catch (e) {
    log('PPGLiveActivities: Initialization failed - $e');
    rethrow;
  }
}