Android IAM Util

The Android IAM Util library exposes a simplified API through the IamUtil class for pairing scenarios and other interaction with the IAM CoAP interface on Nabto Edge Embedded SDK devices.

This saves the developer for the hassle of manually invoking the CoAP endpoints and ensuring correct encoding of input data.


As with other Android based libraries, IAM Util should be added to your project level build.gradle as a Gradle dependency.

implementation 'com.nabto.edge.client:iam-util:2.2.0'

For Kotlin users we have an extension library that can be added as another dependency. Note that the former dependency still needs to be present.

implementation 'com.nabto.edge.client:iam-util:2.2.0'
implementation 'com.nabto.edge.client:iam-util-ktx:2.2.0'


Once the Gradle dependency has been added, you can use the IamUtil class in the following way.

import com.nabto.edge.iamutil.*;
IamUtil iam = IamUtil.create();
try {
  DeviceDetails details = iam.getDeviceDetails(connection);
  Log.i(TAG, "Nabto Embedded SDK version:" + details.getNabtoVersion());
  Log.i(TAG, "Device app version:" + details.getAppVersion());
  Log.i(TAG, "Device app name:" + details.getAppName());
  Log.i(TAG, "Pairing modes available:" + Arrays.toString(details.getModes()));
} catch (IamException e) {
  Log.e(TAG, "iam.getDeviceDetails failed with status " + e.getError().name());


The kotlin extension library iam-util-ktx exposes Async functions meant to be used with Kotlin coroutines.

val iam = IamUtil.create()
  myCoroutineScope.launch {
    try {
      DeviceDetails details = iam.getDeviceDetailsAsync(connection)
      Log.i(TAG, "Nabto Embedded SDK version:" + details.getNabtoVersion())
      Log.i(TAG, "Device app version:" + details.getAppVersion())
      Log.i(TAG, "Device app name:" + details.getAppName())
      Log.i(TAG, "Pairing modes available:" + Arrays.toString(details.getModes()))
    } catch (e: IamException) {
      Log.e(TAG, "iam.getDeviceDetails failed with status " + e.getError().name())

The async version of functions (such as the above iam.getDeviceDetailsAsync()) are suspending functions that will suspend the execution of the enveloping coroutine until the function is finished. Using coroutines in Kotlin is the recommended way to avoid blocking the main thread on Android. See Kotlin coroutines on Android for further information.