README.md 2.93 KB
Newer Older
Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
<!---
  ~ //******************************************************************
  ~ //
  ~ // Copyright 2018 DEKRA Testing and Certification, S.A.U. All Rights Reserved.
  ~ //
  ~ //******************************************************************
  ~ //
  ~ // Licensed under the Apache License, Version 2.0 (the "License");
  ~ // you may not use this file except in compliance with the License.
  ~ // You may obtain a copy of the License at
  ~ //
  ~ //      http://www.apache.org/licenses/LICENSE-2.0
  ~ //
  ~ // Unless required by applicable law or agreed to in writing, software
  ~ // distributed under the License is distributed on an "AS IS" BASIS,
  ~ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ // See the License for the specific language governing permissions and
  ~ // limitations under the License.
  ~ //
  ~ //******************************************************************
  --->
# Onboarding Tool and Generic Client: Android App
  
## Overview

IoTivity uses the [Android Java Coding Standard](https://source.android.com/setup/code-style) for Java code. In consequence, OTGC Android App uses the same coding standard.
  
## Project Setup

Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
30
The OTGC Android App uses the binary distribution of the IoTivity-lite Android API.
Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
31

Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
32
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.
Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
33

Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
34
To import the IoTivity-lite Android API Binary into the OTGC Android App project:
Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
35

Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
36 37 38 39
1. Go to &lt;iotivity-lite>/swig/iotivity-lite-java/libs.

2. Copy **iotivity-lite.jar** into &lt;otgc-android>/otgc/src/main/jniLibs.

Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
40
3. Copy **libiotivity-lite-jni.so** into &lt;otgc-android>/otgc/src/main/jniLibs/&lt;target_arch>
Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
41 42

where &lt;target_arch> is one of the following values: x86, x86_64, armeabi, armeabi-v7a, armeabi-v7a-hard or arm64-v8a.
Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
43
    
Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
44
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.
Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
45 46 47
  
## Build

Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
48
### IoTivity-lite Android API
Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
49

Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
50
The steps required to build the binary of the IoTivity-lite Android API is shown below:
Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
51

Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
52 53 54 55
1. Change to the **swig** branch.
```
git checkout swig
```
56
2. Apply all patchs of the OTGC in IoTivity-lite
57
```
58
git apply <otgc-linux>/extlibs/patchs/remove_cred_by_credid.patch
59 60
git apply <otgc-linux>/extlibs/patchs/bwt_fix.patch
git apply <otgc-linux>/extlibs/patchs/timeout_fix.patch
61 62
```
3. Go to the **android** directory.
Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
63 64 65
```
cd <iotivity-lite>/port/android
```
66
4. Execute the command to build the library.
Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
67 68 69
```
make NDK_HOME=<ndk-directory> ANDROID_API=21 DEBUG=1 SECURE=1 IPV4=1 TCP=0 PKI=1 DYNAMIC=1 CLOUD=0 JAVA=1 IDD=1
```
Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
70

Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
71 72 73 74
Once built, the library can be found at:
```
<iotivity-lite>/swig/iotivity-lite-java/libs
```
Javier Guerra Melgares's avatar
Javier Guerra Melgares committed
75 76 77 78 79 80 81 82 83 84
  
## 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.