HarmonyOS Native SDK
Lifecycle and Cleanup

Lifecycle and Cleanup

Release page-level resources with the ArkUI page. Shut down modules only when the application no longer needs the complete SDK.

Clear caches

await GizSDKManager.cleanCache();

This clears logs and data point configuration caches. It does not replace logout().

Query module status

const bluetoothReady: boolean = GizBluetoothManager.isReady();
const bluetoothStatus: string = GizBluetoothManager.getStatus();
const lanReady: boolean = GizLanManager.isReady();
const lanStatus: string = GizLanManager.getStatus();
const mqttReady: boolean = GizMqttManager.isReady();
const mqttStatus: string = GizMqttManager.getStatus();

getStatus() returns diagnostic text and should not be treated as a stable business enum.

Read all module versions on the Initialization page. Use OHPM and runtime results as the source of truth.

Page-level cleanup

GizBluetoothManager.stopBleScan();
await GizLanManager.stopDiscovery();
await device.bleCapability.disconnect(device);
await device.lanCapability.disconnect(device);
 
unsubscribeBluetooth();
unsubscribeLan();
unsubscribeData();
unsubscribeStatus();

Shut down all modules

GizMqttManager.shutdown();
GizLanManager.shutdown();
GizBluetoothManager.shutdown();
GizSDKManager.shutdown();

Shut down transport modules before the core module. deregister() is the compatibility name for core shutdown().