Quick Library Installation

Android

This installation guide is aimed at developers who have experience with Android development and its build tools. An installation guide for new developers can be found here.

A completed example application can be found in the Android Repo which has the ability to Join, Discover and Control compliant IoT devices. Simply clone the android repo and open it in Android Studio. From here you can compile and run the example application on your Android device.

Requirements

  • Android API 17+
  • Android Studio 3.0+

Gradle

Step 1: Add the JitPack repository to your root/project build.gradle




 



allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io/' }
  }
}
1
2
3
4
5
6

Step 2: Add the dependency by including it in your module's app/build.gradle



 


dependencies {
  ...
  implementation 'com.github.decentralised-home-automation-protocol:DHAP-Android:0.1.0'
}
1
2
3
4

Step 3: Add Java 1.8 compatibility. Add the following compileOptions to your app/build.gradle



 
 
 
 


android {
  ...
  compileOptions {
      targetCompatibility JavaVersion.VERSION_1_8
      sourceCompatibility JavaVersion.VERSION_1_8
  }
}
1
2
3
4
5
6
7

Don't forget to sync your project after modifying gradle files.

iOS

Requirements

Cocoapods

Step 1: Initialise the project with cocoapods.

$ pod init
1

Step 2: Specify platform and version for project in Podfile.


 









# Uncomment the next line to define a global platform for your project
platform :ios, '12.0'

target 'DHAPLibTest' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for DHAPLibTest

end
1
2
3
4
5
6
7
8
9
10

Step 3: Add the DHAP library as a dependency in Podfile.









 


# Uncomment the next line to define a global platform for your project
platform :ios, '12.0'

target 'DHAPLibTest' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for DHAPLibTest
  pod 'DHAP', '~> 0.3'
end
1
2
3
4
5
6
7
8
9
10

Step 4: Install the dependency.

$ pod install
1

Step 5: Open the workspace.

open DHAPLibTest.xcworkspace
1

Make sure to open the workspace and not the project from this point on.