HarmonyOS Native SDK
OTA
Cancel OTA

Cancel OTA

Cancel through the unified capability

await device.bleCapability.cancelUpgrade(device);

You can also use a previously obtained low-level OTA manager:

await otaManager.cancelUpgrade();

Cancellation stops the pending upgrade command and sends a protocol cancellation command when supported. Wait for the Promise before allowing the user to start another upgrade.