beginSession static method

  1. @Deprecated('This function is deprecated, please use "beginSession" of Countly.instance.sessions instead')
Future<String?> beginSession()

Starts session for manual session handling. This method needs to be called for starting a session only if manual session handling is enabled by calling the 'enableManualSessionHandling' method of 'CountlyConfig'.

Implementation

@Deprecated('This function is deprecated, please use "beginSession" of Countly.instance.sessions instead')
static Future<String?> beginSession() async {
  if (!_instance._countlyState.isInitialized) {
    String message = '"initWithConfig" must be called before "beginSession"';
    log('beginSession, $message', logLevel: LogLevel.ERROR);
    return message;
  }
  log('Calling "beginSession", manual session control enabled:[$_manualSessionControlEnabled]');

  if (!_manualSessionControlEnabled) {
    String error = '"beginSession" will be ignored since manual session control is not enabled';
    log(error);
    return error;
  }
  final String? result = await _channel.invokeMethod('beginSession');

  return result;
}