getDeviceID static method

Future<String> getDeviceID()

Gets the device ID used by Approov to identify the particular device that the SDK is running on. Note that different Approov apps on the same device will return a different ID. Moreover, the ID may be changed by an uninstall and reinstall of the app.

@return String representation of the device ID

Implementation

static Future<String> getDeviceID() async {
  await _requireInitialized();
  if (!_isApproovActive) {
    // Bypass mode (empty initial config): there is no active Approov SDK
    // instance to provide a device ID, so reject rather than forwarding a
    // doomed call to the platform channel.
    throw ApproovException("Approov is not enabled");
  }
  try {
    String deviceID = await _invokeFgMethod('getDeviceID');
    Log.d("$TAG: getDeviceID: $deviceID");
    return deviceID;
  } catch (err) {
    throw ApproovException('$err');
  }
}