Skip to content

iotivity/otgc-android

Repository files navigation

Onboarding Tool and Generic Client: Android App

Overview

IoTivity uses the Android Java Coding Standard for Java code. In consequence, OTGC Android App uses the same coding standard.

Project Setup

The OTGC Android App uses the binary distribution of the IoTivity-lite Android API.

IoTivity-lite Android API is compiled for a minimum SDK of API 21: Android 5.0 (Lollipop), so OTGC Android App shall use the same value.

To import the IoTivity-lite Android API Binary into the OTGC Android App project:

  1. Go to <iotivity-lite>/swig/iotivity-lite-java/libs.

  2. Copy iotivity-lite.jar into <otgc-android>/otgc/src/main/jniLibs.

  3. Copy libiotivity-lite-jni.so into <otgc-android>/otgc/src/main/jniLibs/<target_arch>

where <target_arch> is one of the following values: x86, x86_64, armeabi, armeabi-v7a, armeabi-v7a-hard or arm64-v8a.

Android Studio loads the library, including the contents of the library module. IoTivity-lite Android APIs can now be used in the OTGC Android App project.

Build

IoTivity-lite Android API

The steps required to build the binary of the IoTivity-lite Android API is shown below:

  1. Change to the swig branch.
git checkout swig
  1. Go to the android directory.
cd <iotivity-lite>/port/android
  1. Execute the command to build the library.
make NDK_HOME=<ndk-directory> ANDROID_API=21 DEBUG=1 SECURE=1 IPV4=1 TCP=1 PKI=1 DYNAMIC=1 CLOUD=1 JAVA=1 IDD=1

Once built, the library can be found at:

<iotivity-lite>/swig/iotivity-lite-java/libs

Testing

Usage

License

This library is released under Apache 2.0 license (http://www.apache.org/licenses/LICENSE-2.0.txt).

Please see the file 'LICENSE.md' in the root folder for further information.