React Native SDK
Initialization

Initialization

Initialize SDK

ℹ️

serverInfo is optional. If not provided, it will be automatically selected based on the region of the mobile phone.

import RNGizSDKManagerModule from 'react-native-gizwits-sdk-v5';
let data = await RNGizSDKManagerModule.initSDK({
  appID: 'xxx',
  appSecret: 'xxx',
  productInfos: [
    {
      productKey: 'xxx',
      productSecret: 'xxx',
    },
  ],
  serverInfo: {
    openAPIInfo: "api.gizwits.com"
  }
});

Lifecycle

The current RN SDK does not export destroy or destory. Initialize once at the application entry point. Remove your event listeners when components unmount, and stop scanning or provisioning as needed. cleanCache() clears cached data; it does not destroy the SDK. Repeated initialization registers duplicate native event listeners.

China Mobile AiJia Module Discovery

productInfos supports the optional cmbDeviceTypeId. For China Mobile AiJia CMB BLE devices, supply the device type ID so the SDK can map advertisements to products. Omit it for ordinary devices.

const productInfo = { productKey: 'PK', productSecret: 'PS', cmbDeviceTypeId: 'DEVICE_TYPE_ID' };