getCurrentDeviceId static method

  1. @Deprecated('getCurrentDeviceId is deprecated, use getID of Countly.instance.deviceID instead')
Future<String?> getCurrentDeviceId()

Get currently used device Id. Should be call after Countly init returns the error message or deviceID

Implementation

@Deprecated('getCurrentDeviceId is deprecated, use getID of Countly.instance.deviceID instead')
static Future<String?> getCurrentDeviceId() async {
  log('Calling "getCurrentDeviceId"');
  log('getCurrentDeviceId is deprecated, use getID of Countly.instance.deviceID instead', logLevel: LogLevel.WARNING);
  if (!_instance._countlyState.isInitialized) {
    String message = '"initWithConfig" must be called before "getCurrentDeviceId"';
    log('getCurrentDeviceId, $message', logLevel: LogLevel.ERROR);
    return message;
  }
  String? result = await _instance.deviceId.getID();

  return result;
}