Android

Getting started

  1. Add the Akiles Maven repo to repositories{} in settings.gradle or build.gradle.

Kotlin (build.gradle.kts):

repositories {
    maven {
        url = uri("https://maven.akiles.app/release")
    }
}

Groovy (build.gradle):

repositories {
    maven {
        url = uri("https://maven.akiles.app/release")
    }
}
  1. Add a dependency on the Akiles SDK in build.gradle for your application module.

Kotlin (build.gradle.kts):

dependencies {
    implementation("app.akiles:sdk:2.1.0")
}

Groovy (build.gradle):

dependencies {
    implementation 'app.akiles:sdk:2.1.0'
}

Finally, click “Sync Now” in Android Studio to sync the Gradle build.

Permissions

From your Activity, propagate calls to onRequestPermissionsResult to the Akiles SDK.

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    akiles.onRequestPermissionsResult(requestCode, permissions, grantResults);
}

Card emulation

The SDK can do NFC card emulation to allow opening doors via holding it in front of an NFC-enabled Akiles device.

Setup

First, create an AID for your application:

Warning

Each AID you create makes NFC reading slightly slower. Do not create unnecessary AIDs. You can use the same AID for Android and iOS, do not create both. The only case where you really need multiple AIDs is when you have multiple Android apps and expect users to have them installed at the same time.

Add the following inside the <manifest> tag in AndroidManifest.xml:

<uses-feature android:name="android.hardware.nfc.hce" android:required="false" />

Add the following inside the <application> tag in AndroidManifest.xml:

<service android:name="app.akiles.sdk.AkHostApduService" android:exported="true"
    android:permission="android.permission.BIND_NFC_SERVICE">
    <intent-filter>
        <action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE"/>
    </intent-filter>
    <meta-data android:name="android.nfc.cardemulation.host_apdu_service"
        android:resource="@xml/akilesapduservice"/>
</service>

Add a new file res/xml/akilesapduservice.xml with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
    android:description="@string/akiles_hce_service_desc"
    android:requireDeviceUnlock="false"
    android:requireDeviceScreenOn="false">
    <aid-group android:description="@string/akiles_hce_aid_desc"
        android:category="other">
        <aid-filter android:name="F37ABDC6xxxx" />
    </aid-group>
</host-apdu-service>

Add a new file res/values/strings.xml with the following contents:

<resources>
    <string name="akiles_hce_service_desc">Akiles HCE Service</string>
    <string name="akiles_hce_aid_desc">Akiles AID group</string>
</resources>

Replace the AID F37ABDC6xxxx with the AID provided to you by Akiles Support.

Usage

If you have added multiple sessions to the SDK, all of them are automatically checked when tapping the phone to the Akiles device.

Android versions

The SDK supports Android API level 23 (Android 6) or higher.

Bluetooth requires API level 29 (Android 10) and higher. On lower versions, Bluetooth operations always fail with error code BLUETOOTH_NOT_AVAILABLE, but the rest of the SDK still works. For example, doing gadget actions still works, but only via internet.

Demo app

Demo app screenshot

The SDK demo app showcases all major SDK features:

The app displays real-time status updates for both internet and Bluetooth operations, making it easy to test different scenarios.