Getting started

This topic guide describes how you should get started with the Onegini Android SDK. It outlines how the API is set up, how the SDK generally works and what the requirements are.

We first advice you to read the App developer quickstart before reading this topic guide.

General setup of the Onegini Android SDK


The main facade of the SDK is the OneginiClient. This class exposes the other Onegini client objects (UserClient and DeviceClient) that you can access. The OneginiClient is a singleton of which you can only construct a single instance using the OneginiClientBuilder class. The other clients that can be accessed through the OneginiClient are:

  • UserClient - only contains user related functionality
  • DeviceClient - only contains device related functionality

Thread safety

All methods that you call on the Onegini Android SDK must be performed on the main thread of your mobile application. The SDK will not enforce this, hence you might expect strange behaviour if you do not execute the methods on the main thread. Internally the SDK will use multiple threads to make sure it does not block the main thread. You as a developer only have to make sure that you execute the SDK methods from the main thread.

Delegating control from the app to the SDK and vice versa

To utilize the functionality that the SDK provides you must integrate it into your application. The functionality that the SDK provides sometimes require interaction with the end-user. The SDK itself does not contain any UI but will request you to implement specific actions for your end-users.

The general setup is that you must trigger a functionality in the SDK by calling one of it's methods. Let's take user authentication as an example.

In order to start the user authentication you must call the UserClient.authenticateUser() method. Below is an example of this method call (taken from the Android example app):

OneginiSDK.getOneginiClient(this).getUserClient().authenticateUser(userProfile, new OneginiAuthenticationHandler() {

  public void onSuccess(final UserProfile userProfile, final CustomInfo customInfo) {
    // Authentication successful

  public void onError(final OneginiAuthenticationError oneginiAuthenticationError) {
    // Authentication failed

The second parameter that you must provide is a handler. This handler is responsible for giving you the feedback whether the result of the triggered action was successful or not. However as a part of the authentication functionality a few things happen. Depending on the authentication method that is preferred for a user the user will be requested to enter his/her PIN or perform fingerprint authentication. This action is triggered by the SDK. The SDK provides special RequestHandlers for this that need to be implemented by you.

A RequestHandler is a class that contains methods to hand over control from the SDK to your application. When the preferred method of authentication for a user is PIN authentication the startAuthentication method of the class that implements the OneginiPinAuthenticationRequestHandler interface is called. After the end-user has entered his/her PIN, the PIN needs to be provided to the SDK to continue the authentication flow. The startAuthentication method contains a callback object to submit the PIN to the SDK.

Since the SDK is a stateful library, you should not call asynchronous methods (like authenticateUser() or start()) in parallel. In particular, if you will try to call the same method multiple times while the first call has not finished yet, you can receive an ACTION_ALREADY_IN_PROGRESS error.

Error handling

Interaction with the Onegini SDK can result in errors. Please check out our error handling topic guide for more details on error handling.

SDK Requirements

The Onegini Android SDK supports apps running on API level 19+ (Android KitKat and newer), so make sure that your project also sets it's minimum API level to 19+.

Reasons why older platforms are not supported

The number of devices with API lower that 19 is relatively small and it's constantly decreasing. Supporting many different API versions is getting more and more complex over time. Different versions of Android's API have different bugs, including security vulnerabilities. Some of the vulnerabilities force us to protect the app with additional workarounds, that significantly increase development time and in some cases it also slows down the performance of an app. Other vulnerabilities can't be solved at all by the SDK.

Third party libraries

The SDK depends on a number of third party libraries. The SDK does not contain the libraries it depends on but we clearly describe here on which libraries we depend on. We try to keep this to a minimum to not bother you with a huge list of dependencies that you must add to your application. Our policy is to always use the latest available versions of the libraries used by us.

Library Version Description
com.squareup.okhttp3:okhttp 3.12.10 Http client
com.squareup.okhttp3:okhttp-urlconnection 3.12.10
com.squareup.okhttp3:logging-interceptor 3.12.10
com.squareup.retrofit2:retrofit 2.6.4 REST client
org.bouncycastle:bcprov-jdk15on 1.64 Implementation of cryptographic algorithms
org.bouncycastle:bcpg-jdk15on 1.64 Implementation of the OpenPGP protocol
commons-io:commons-io 2.6 Apache Commons IO
com.onegini.misc:og-ocra 100.0.0 OCRA Implementation 2.27 Dependency injection library
io.reactivex.rxjava2:rxjava 2.2.19 Library for reactive programming
io.reactivex.rxjava2:rxandroid 2.1.1 Library for reactive programming on Android
net.zetetic:android-database-sqlcipher 4.3.0 Encryption library for SQLite database
org.jetbrains.kotlin:kotlin-stdlib-jdk7 1.3.70 Kotlin Standard Library JDK 7 extension

Android User-Permissions

The SDK declares following permissions in the AndroidManifest.xml file:

  <!-- SDK's AndroidManifest.xml -->
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.USE_FINGERPRINT" />

Those permissions are required to gain access to the network and in order to use fingerprint authenticator. During a build process of an app those permissions will be merged to the app's AndroidManifest automatically by a tool called Manifest Merger


Google Play App Signing

Google Play currently offers two ways for app signing:

  • managing keys and keystore locally
  • using the Google Play App Signing

The first option allows you to store your app signing key locally on your machine and use it to sign the app before publishing it:

Manual Signing

The second option allows you to store the private key in Google cloud services and allow the Google Play to sign the app after uploading it to the store:

Google Play App Signing

The downside of the Google Play App Signing is that the Google Play not only changes the signature of the app, but also slightly modifies its binaries (including the AndroidManifest file). As a result the application signature will change after the store signing. This is fine as long as you are aware that the application signature calculator has to be used AFTER the app signing step, regardless if it was done locally or in the Google Play Store.

App bundle

Similar to the Google Play App Signing, the App Bundle defers the app signing step and modifies the app binary. The Dynamic Delivery and Dynamic Feature Modules are modifying the app binaries even further, making the tampering protection impossible. Because the tampering protection is a crucial functionality of the Onegini Android SDK, you cannot use the App Bundle format.