Skip to navigation

Getting started

Add the HUMAN SDK library to your project

This guide is relevant for the current Mobile SDK. While we highly recommend using the latest version, if you are using a legacy integration, refer to the iOS or Android documentation.

To get started with the HUMAN SDK, you need to first add the library to your project.

Add the SDK to your project

1

Add permissions

Add the following permissions to your AndroidManifest.xml file:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
2

Add the library to your dependencies

  1. Add the SDK repository to the repositories section in your project’s build.gradle and settings.gradle:
buildscript {
repositories {
google()
mavenCentral()
maven { url 'https://jfrog.humansecurity.com/artifactory/human-android-sdk/' }
}
}
  1. Add the SDK dependency to the dependencies section in your app’s build.gradle:
dependencies {
implementation 'com.humansecurity:sdk:4.2.15'
}
3

R8 optimization

R8 is a tool that shrinks, secures, and optimizes Android applications, but it can sometimes cause issues with the ktor library that’s included in the SDK. To prevent this, add the following rule to your proguard file:

ProGuard
-keepclassmembers class kotlinx.** {
volatile <fields>;
}

Add the package from the human-security-ios-sdk-spm repository.

human-security-ios-sdk-spm is a specialized repository that contains a pointer to the precompiled XCFramework included in the latest HUMAN SDK release, allowing for quicker downloads. We recommend using this repository rather than the main human-security-ios-sdk repository.

Handle multiple Application IDs

If you have multiple HUMAN Applications and Application IDs, you can use the following to support all of them within the SDK:

  1. Call the HumanSecurity/start(appIds:policy:) function and provide all your Application IDs.
  2. Pass the relevant ID to each function that requires the appId parameter. For single AppID apps, the value may be nil or null.

Finish your integration

Next, follow the respective guides based on your environment and requirements:

ImplementationDetails
Native (recommended implementation)
  • Fast integration with minimal points.
  • SDK intercepts your URL requests.
  • Handles blocked requests.
  • Not recommended if you need to retry requests after solving challenges.
  • Not recommended if you use advanced URLSession features (authentication challenges, caching, etc.).
Native (basic implementation)
  • Few integration points.
  • SDK does not intercept URL requests.
  • Handles blocked requests.
  • Notifies when a challenge is solved or canceled; great for analytics and logs.
  • Not recommended for retrying requests after challenges.
  • Not recommended as a trigger for resending URL requests.
Native (advanced functionality)
  • SDK intercepts URL requests.
  • Handles blocked requests with challenge results (solved/canceled); great for analytics, logs, and resending URL requests.
  • Option to automatically retry blocked requests after challenges.
  • Recommended if you need to retry requests after challenges.
  • Not recommended if you use advanced URLSession features.
Hybrid app
  • Use this when the app loads a HUMAN-protected site in an in-app WebView and also makes native URL requests.
  • Keeps the native SDK VID and the WebView VID the same.
  • Set hybridAppPolicy.webRootDomains to the site’s registrable root.
WebView container support
  • Shows which WebView containers can share the native VID.
  • Covers native WebViews and wrapper-hosted WebViews, such as React Native, Flutter, Ionic, and Expo.
visionOS

Verify & test the integration

Use our guide to verify and test the SDK integration in your app.