SigningHub Android SDK Integration
The "Android SDK Integration" page is intended for developers who are interested in writing applications which will use the capabilities offered by SigningHub Mobile SDK. It is assumed that the reader has a basic knowledge of Android, Kotlin, and Gradle.
Overview
The SigningHub Android SDK is built on top of our REST-based API web services. This SDK is a quick way to integrate SigningHub with different mobile applications. SigningHub Mobile SDK provides the following features:
Document preparation
Upload documents from local files, library, and cloud drives (Google Drive, OneDrive, and Dropbox)
Add, update, and delete recipients (contact, group, placeholder, electronic seal)
Add signature fields (digital signature, electronic signature, In-person signature, initials)
Add form fields (input field, check box, radio box)
Add attachment field
Add QR code
Add drop-in comment
Access authentication (shared password, OTP, TOTP)
Access duration (based on dates, based on days)
Document viewing
Draft
In-Progress
Pending
Signed
Declined
Approved
Updated
Completed
Form filling
Text field
Check box
Radio button
Drop down, etc.
Adding initials
Signing In-person
Electronic signature (with or without witness signature)
Legal notice
Server-side signing authentication
Signing using a hand-drawn image, an uploaded image (via photo gallery) or text-based typography (using a fixed embedded font)
Document signing (digital signature)
Authorise remote signing for a qualified signature
View existing signatures and verification details
Declining a document
Approving a document
Editing a document
Branding
Localization
Add SigningHub SDK to an Android application project
To use the SigningHub Mobile SDK in an Android application project, follow the steps below:
In your app-level build.gradle file set minSDK = 24: Android 7.0 or higher. The SigningHub Mobile SDK supports Minimum SDK API 24: Android 7.0.
Open your Android project, and add “signinghub-android-sdk.aar” in the 'app/libs' folder.
Add “gosign-mobile-sdk.aar” in the ‘libs’ folder if you are expected to use remote authorisation signing.

Open build.gradle associated with “app” and include this: it will add the .aar file in the libs folder to your project.

We don’t publish the SigningHub SDK on Maven or Google repository; instead, we provide the .aar file. This file does not include metadata information about the dependencies of this SDK, so the host app needs to add this SDK’s dependencies in its Gradle file for the SDK to be fully functional.
The final build.gradle.kts file will have the following items.
Set the Application class name in the manifest to the following:
Change the default theme of your App to your desired theme with NO_ACTION_BAR in “styles.xml” file.
(Optional but Recommended) The SigningHub SDK is built using the Material 3 theme. To ensure a consistent and error-free UI experience, it is recommended to extend your app's theme from the SH10M3 theme, as shown below. You can customise the theme properties to match your design preferences.
Using the SigningHub SDK: Features and implementation
The Android application needs to import the following classes in its code:
com.signinghub.sdk.managers.SessionManager
com.signinghub.sdk.managers.DocumentManager
The SigningHub Mobile Android SDK authenticates the user who is registered in the SigningHub and then provides the supported features.
Authentication
Manages user authentication and session-related operations. This class provides a high-level abstraction for handling authentication.
Features
This class offers the following key features to support secure and seamless authentication:
Token Management: Fetch client tokens, refresh access tokens, and manage authentication tokens.
User Authentication: Authenticate users via password or Single Sign-On (SSO).
Session Management: Check authentication status, retrieve access tokens, and log out users.
API Base URL Management: Update and retrieve the API base URL dynamically.
Error Handling: Robust error handling with detailed error messages.
Class structure
The SessionManager class with the following key methods:
fetchClientToken: Fetches a client token for initial authentication.
authenticateWithPassword: Authenticates a user using their email and password.
authenticateWithSSO: Authenticates a user via Single Sign-On (SSO).
refreshAccessToken: Refreshes an expired access token.
LogoutUser: Logs out the user and clears authentication data.
isUserAuthenticated: Checks if the user is authenticated.
getAccessToken: Retrieves the current access token.
Usage
Callbacks & example
Response
All methods in the SessionManager and all other classes return their results via a Resource sealed class. This class encapsulates the state of an operation, such as success, loading, error, or empty states. The Resource class is generic, allowing it to handle any type of data (T).
Class structure
Open document
Once the authentication is done, document opening can be handled via the DocumentManager class.
Overview
The DocumentManager class is a utility object provided by the SigningHub SDK to manage document-related workflows. It simplifies the process of creating, cloning, and opening workflows for actions such as signing or reviewing documents. This class serves as the primary entry point for interacting with the SDK's workflow management features.
Key Features:
Workflow Initialisation: Start new workflows from scratch or by cloning existing packages.
Workflow Management: Open existing workflows for actions like signing or reviewing.
Lifecycle-Aware Results: Uses ActivityResultLauncher for handling activity results in a modern and lifecycle-aware manner.
Efficient Workflow Handling: Pre-fetched workflow details can be used to avoid redundant API calls.
Class structure
The DocumentManager class is a singleton object with the following key methods:
startNewWorkFlow: Starts a new workflow from scratch.
startNewWorkflowFromExistingPackage: Starts a new workflow by cloning documents from an existing package.
openPackageViewer: Opens an existing workflow for actions like signing or reviewing.
startSdkActivity: A private helper method to launch the SDK's main activity with the required parameters.
Usage
Branding
Branding in SigningHubSDK allows customisation of the app's appearance using different colour levels. The backend provides two types of branding:
Admin Branding – Applied globally across all enterprises.
Enterprise Branding – Custom branding per enterprise.
Developers can retrieve branding settings using the REST APIs provided by SigningHub. The SDK automatically applies branding when provided with valid colour data for branding.
Colour level usage in the app
Level 2: Primary button background (used for main action buttons).
Level 3: Negative actions (e.g., Delete, Remove, Logout).
For filled negative buttons, Level 3 is the background colour.
For outlined/text buttons, Level 3 is the text/icon colour.
Level 5: Content displayed on Level 2 colour (text colour).
Level 15: Text and icon colour for the negative button's colour.
Branding API endpoints
API calls for branding are written in GlobalRepository. When you call the APIs using our provided repository, branding colours are applied automatically.
Custom branding
If you do not call the APIs mentioned above and want to provide your own colours directly, you can use the helper function provided in the document manager. Ensure that you call this method before opening any workflow.
Push notifications for Android level 33 or above (Optional)
To be able to receive push notifications on Android level 33 or above, Runtime permission is required as per the Google Developer Guide. Add Runtime permission on App side:

Example project on Bitbucket
To help developers get started quickly, we provide an example project hosted on Bitbucket. This project demonstrates how to integrate and use the SigningHub SDK within an Android application.
Repository URL: SigningHub SH10 SDK Example
Steps to use the example project:
Clone the Repository: git clone https://bitbucket.org/ascertia-signinghub/sh10-sdk-example.git
Open the Project in Android Studio.
Add the SigningHub SDK:
Navigate to the app/libs folder.
Manually place your signinghub-sdk-release.aar file inside this folder.
Sync and Run the Project:
In Android Studio, click on File > Sync Project with Gradle Files.
Build and run the project on a device or emulator.
The SDK AAR file is not included in the example project due to licensing. You must add your own signinghub-sdk-release.aar file inside the app/libs folder to successfully run the project.
Last updated
Was this helpful?

