React Native SDK
API and Version Notes

API and Version Notes

Applies to react-native-gizwits-sdk-v5@1.7.11-beta, with native dependencies Android 1.4.12 and iOS ~> 2.1.8.

SDK Management

import RNGizSDKManagerModule from 'react-native-gizwits-sdk-v5';
 
const devicesResult = await RNGizSDKManagerModule.getDevices();
if (devicesResult.success) {
  console.log(devicesResult.data);
}
const configResult = await RNGizSDKManagerModule.getProductDataPointConfig('PRODUCT_KEY');

Devices returned by getDevices() have capability methods attached. The current declaration incorrectly uses a one-element tuple [IDevice]; runtime data can contain zero or more devices.

cleanCache() clears cached data; it does not destroy the SDK. There is no public destroy() or destory(). Initialize once with initSDK() to avoid duplicate native listeners, and remove component listeners with their corresponding remove...Listener methods.

Provisioning and OTA Differences

FeatureCurrent supported path
BLE bindWithUidUse RNGizDeviceManagerModule.provideWiFiCredentials(id, 'BLE', ssid, password, timeout, callback, bindWithUid); the device convenience method drops the flag
AI module cloud bindingEnable bindWithUid and authorize the user when the AI module establishes its own cloud binding; see BLE provisioning
LAN bindWithUidThe native bridge forces false, even when JS passes true
AirLinkUse the native callback API in AirLink provisioning
Cancel OTAAvailable natively but not wrapped on the JS device; see Cancel OTA
Provisioning timeoutSeconds on Android and iOS; use 60 for 60 seconds

Ordinary business failures resolve with GizResult.success === false rather than automatically rejecting the Promise. Also handle exceptions such as bridge errors. Do not rely on catch alone for business failures.

Types and Native Data

  • getAuthorizeData() normalizes authorization to { uid, token }. Android login results do not contain that object, and registration results use userId; query authorization explicitly.
  • GizWiFiActivatorEvent.data is a string on Android and a number on iOS. The event list includes device log events missing from the current TypeScript union.
  • Serialized BLE profiles include support5GConfig and bleModuleVariant, which are missing from RN declarations.
  • Native BLE protocolVersion and authenticationMethod values are strings, while RN still declares numbers. Narrow actual runtime values instead of relying on numeric comparisons.
  • Android sendDp() reports success without guaranteeing a complete data point payload. Observe addDeviceDataListener or call getDp() for data. The current sendDp() and startUpgrade() declarations overstate their data payloads; check that fields actually exist.

Musical Rhythm

Device objects expose startMusicalRhythm(sensitivity, mode, callback?) and stopMusicalRhythm(). mode is 'ROCK' or 'SOOTHING'; callbacks contain { deviceID, data }. Recording permission and device support are required.

const result = await device.startMusicalRhythm(50, 'ROCK', ({ deviceID, data }) => {
  console.log(deviceID, data.isBeat, data.bpm);
});
// Stop when no longer needed:
// await device.stopMusicalRhythm();