Getting started with the SDK

The following section describes how to integrate the mobile SDKs and the main methods that are required to operate with Harbor Lockers.

Using Expo

We recommend using the react native cli instead of expo
The Harbor SDK contains native code, We highly recommend using react native cli instead of expo If you insist on using Expo, you will need to eject, following this guide Here. We have not been able to test this sucessfully yet.
After ejecting, follow the rest of the guide as a regular react-native user.

Integrate SDK with React-Native

npm i @harborlockers/react-native-sdk' or yarn install @harborlockers/react-native-sdk

And then import the SDK in whichever file you want to use it in.

import HarborLockersSDK from '@harborlockers/react-native-sdk';

Integrate SDK with iOS

The iOS SDK is available through Cocoapods. Add the following line to your Podfile:

pod "HarborLockersSDK"

You can also specify the version of the SDK, for example:

pod "HarborLockersSDK", '1.0.10'

Then run pod install to install the pods. To start using the HarborSDK, you must import it into your files

@import HarborLockersSDK

The iOS SDK requires Bluetooth access, in your info.plist add the following entries:

  • NSBluetoothAlwaysUsageDescription -> A description of why your app needs access to Bluetooth.

  • NSBluetoothPeripheralUsageDescription -> Same description as before. This is needed only if your app targets iOS 12 or earlier.

Integrate SDK with Android

The Android SDK is distributed through Jitpack. It can be integrated through gradle, maven, sbt, and leiningen as following:

How to Integrate Harbor Android SDK in Different Build Systems

Gradle

In your root build.gradle, add the JitPack repository at the end of repositories:

allprojects {
    repositories {
        // Other repositories...
        maven { url 'https://jitpack.io' }
    }
}

Then, include the Harbor Android SDK as a dependency:

dependencies {
    implementation 'com.github.Harbor-Lockers:harbor-android-sdk:<version>'
}

Maven

To integrate with Maven, add the JitPack repository to your build file:

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

Next, include the Harbor Android SDK as a dependency:

<dependency>
    <groupId>com.github.Harbor-Lockers</groupId>
    <artifactId>harbor-android-sdk</artifactId>
    <version>version_number</version>
</dependency>

SBT

For SBT integration, add the JitPack resolver to your build.sbt at the end of resolvers:

resolvers += "jitpack" at "https://jitpack.io"

Then, add the Harbor Android SDK as a library dependency:

libraryDependencies += "com.github.Harbor-Lockers" % "harbor-android-sdk" % "Tag"

Leiningen

To integrate with Leiningen, update your project.clj by adding the JitPack repository at the end of repositories:

:repositories [["jitpack" "https://jitpack.io"]]

Then, include the Harbor Android SDK as a dependency:

:dependencies [[com.github.Harbor-Lockers/harbor-android-sdk "Tag"]]

Add the following entries to your AndroidManifest.xml:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>

The android:required value in the last line depends on wether you want your app to be listed to users that doesn’t have BLE support on their devices. This might be the case if all your app does is control lockers with Harbor SDK and can’t do anything useful without BLE support.

Once you have everything set up, We can get an access token