Fast Integration with IPC SDK for Android

Last Updated on : 2024-04-12 08:29:25download

IPC SDK helps you implement IP camera (IPC) functionalities on top of the modules provided by Smart Life App SDK, such as user management, device pairing, home management, and device management.

Before you start

The IPC SDK is developed based on the Smart Life App SDK. Before integration with the IPC SDK, perform the steps described in Fast Integration with Smart Life App SDK for Android.

Fast integration

Configure build.gradle

  • Configure the file build.gradle in the root directory of your project.

    allprojects {
        repositories {
            ...
            maven {
                url "https://maven-other.tuya.com/repository/maven-releases/"
            }
            maven { url "https://maven-other.tuya.com/repository/maven-commercial-releases/" }
        ...
        }
    }
    
  • Configure build.gradle in the app directory.

    defaultConfig {
        ndk {
           abiFilters "armeabi-v7a","arm64-v8a"
        }
    }
    packagingOptions {
        pickFirst 'lib/*/libc++_shared.so'
        pickFirst 'lib/*/libyuv.so'
        pickFirst 'lib/*/libopenh264.so'
    }
    dependencies {
        ...
        implementation 'com.thingclips.smart:thingsmart-ipcsdk:5.11.0'
        ...
    }
    
    • The earliest Android version supported by the IPC SDK is Android 6.0.0 (API level 21).
    • The IPC SDK supports armeabi-v7a and arm64-v8a by default.
    • The IPC SDK does not support P2P 1.0 devices by default. In this case, the value of p2pType for this type of device is 1. To use this type of device, contact Tuya’s account manager.
    • If you have integrated Smart Life App SDK v3.x.x or v4.x.x into your project, follow the instructions in Upgrade Guide and upgrade to the latest version.

Configure AndroidManifest.xml

Set permissions in AndroidManifest.xml.

<!-- sdcard -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- Network -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

Obfuscate the code

Configure obfuscation in proguard-rules.pro.

-keep class com.thingclips.**{*;}
-dontwarn com.thingclips.**

Demo app

Based on the features of the Smart Life App SDK demo app, the IPC SDK demo app is added with the control panel module for IPCs to implement the following pages:

  • Live streaming: P2P connections of IPCs, live video playing, video recording, screenshot capturing, video talks, and more.

  • Playback: retrieval and playback of video footage from an SD card, and use of timeline components.

  • Cloud Storage for Videos: service subscription, status query, and retrieval and playback of cloud-stored videos and cloud storage events.

  • Messages: retrieval and display of alerts.

  • Settings: use of standard data points for IPCs.

    The demo app that is created in the sample project of Smart Life App SDK is used for reference only. Do not use the demo app for commercial purposes. For more information, see Tuya Developing Service Agreement.