React Native SDK
OTA
Cancel OTA Update

Cancel OTA

The current RN SDK does not wrap cancelUpgrade() on the device object or JS manager. Both native modules export the callback API shown below. OTA currently supports the BLE channel only.

import { NativeModules } from 'react-native';
import type { Types } from 'react-native-gizwits-sdk-v5';
 
const result = await new Promise<Types.GizResult<unknown, unknown>>(resolve => {
  NativeModules.RNGizDeviceManagerModule.cancelUpgrade(
    { id: device.id, type: 'BLE' },
    (error: Types.GizResult<unknown, unknown> | null, data: Types.GizResult<unknown, unknown>) => {
      resolve(error ?? data);
    },
  );
});
if (!result.success) console.log(result.error, result.message);