Door Lock SDK Integration

1. Overview

This article mainly introduces how to integrate the door lock SDK.

2. Preconditions

  1. Confirm completion Preparation
  2. Confirm the completion of Environment Build

3. Features

3.1 Main Function

  1. Support Aqara door lock device pairing.
  2. Support Aqara door lock control.

3.2 SDK Size

Dependent library Illustrate Size
React Native(0.63.4) React Native framework 10MB
Aqara bridge layer Components necessary for the SDK to run 24MB
Other Components necessary for the SDK to run 14MB
Total - 48MB

Note: 48MB is the maximum increment of the integrated SDK, that is, when the dependencies of the third-party app and the third-party dependencies of the SDK have no intersection. Normally, it will be less than this value.

3.3 Support Device Category

See Device List for details.

3. Integrated

The door lock vertical category SDK mainly implements device network access and device control through the technology stack of React Native.

4.1 Install Node

Before integrating the door lock SDK, you need to install React Native-related dependencies, otherwise it cannot be compiled and packaged. It is recommended to create a new branch for integration.

Dependent library Version requirements
Node.js 16.20.2
JDK 1.8

For more information about React Native, please refer to React Native Official Guide

4.1.1 macOS

We recommend using Homebrew to install Node:

Install Node

brew install node

4.1.2 windows

We recommend installing Node via Chocolatey:

Install Node

choco install -y nodejs-lts

Note: If you have already installed Node, the version of Node should be greater than or equal to 14.

4.2 4.2 Configure the Node dependencies of the Door lock SDK

4.2.1 Create package.json in the project root directory

In the root directory of the Android project, create a package.json file and copy the following content into the file.

{
  "name": "rn_demo_0614",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.11.0",
    "lodash": "^4.17.15",
    "prop-types": "^15.7.2",
    "react": "17.0.1",
    "react-native": "0.63.4",
    "react-native-gesture-handler": "^1.5.2",
    "react-native-reanimated": "^1.4.0",
    "react-native-root-toast": "^3.2.0",
    "react-native-screens": "^1.0.0-alpha.23",
    "react-navigation": "^4.0.10",
    "react-redux": "^7.1.3",
    "redux": "^4.0.4",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0",
    "reselect": "^4.0.0"
  },
  "devDependencies": {
    "@babel/core": "7.7.4",
    "@babel/runtime": "7.7.4",
    "@react-native-community/eslint-config": "2.0.0",
    "babel-jest": "26.6.3",
    "eslint": "7.16.0",
    "jest": "26.6.3",
    "jetifier": "^1.6.5",
    "metro-react-native-babel-preset": "0.64.0",
    "react-navigation-stack": "^1.10.3",
    "react-test-renderer": "17.0.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

Execute the following command through the terminal, which will download the corresponding dependencies through package.json and generate a node_modules file in the project root directory.

npm install --legacy-peer-deps

4.3 Integrated Door Lock SDK

4.3.1 Edit build.gradle or settings.gradle in the root directory

repositories {
    maven {
      url "$rootDir/node_modules/react-native/android"
    }
}

4.3.2 Edit build.gradle in the app directory

dependencies {
      //Unified initialization, please pay attention to use the latest version
    implementation 'com.lumi.external:core:2.1.33'
    //Door lock SDK, please pay attention to use the latest version
    implementation 'com.lumi.sdk:reactnative:4.1.14'
}

4.3.3 Edit AndroidManifest.xml

<application>
  ...
  <provider
        android:name="androidx.core.content.FileProvider"
        android:authorities="${applicationId}.fileprovider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/custom_file_paths" />
    </provider>
</application>

custom_file_paths.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <paths>
        <cache-path path="" name="camera_photos"/>
        <external-path path="" name="camera_photos" />
        <files-path path="" name="camera_photos" />
        <root-path path="" name="camera_photos" />
        <external-files-path name="share_files" path="."/>
    </paths>
</resources>

4.4 Initialization

4.4.1 Uniform initialization

See Environment Construction - Unified Initialization

5. Code Confusion

-dontwarn com.facebook.**
-keep class com.facebook.** { *; }
Copyright © 2023 Lumi United Technology Co., Ltd. all right reserved,powered by GitbookFile Modify: 2024-09-27 21:51:47

results matching ""

    No results matching ""