Documentation
  • Overview
  • Usage Guidelines
  • iOS SDK Integration Guide
  • Android SDK Integration Guide
  • Web SDK Integration Guide
    • Example Web SDK Integration
  • Golang SDK Integration Guide
  • React Native SDK Integration Guide
  • Flutter SDK Integration Guide
  • WordPress Plugin Integration Guide
  • Discord Bot Integration Guide
  • FAQ
  • Support
  • Once you hit scale - Fees
  • Adjust language & default country code
  • SMS Terms and Conditions
  • Privacy-Policy
Powered by GitBook
On this page
  • Overview
  • Requirements
  • Steps
  • 1. Downloads
  • 2. Get Credentials
  • 3. Configuration
  • 4. Using the SDK in Kotlin
  • 5. Using the SDK in Java
  • 6. You Are All Set!
  • Sample

Was this helpful?

Android SDK Integration Guide

PreviousiOS SDK Integration GuideNextWeb SDK Integration Guide

Last updated 3 years ago

Was this helpful?

Overview

Requirements

  • API Level 18 or higher

  • Kotlin

Please update to the latest SDK!

Steps

1. Downloads

allprojects {
               repositories {
               ...
                   maven { url 'https://jitpack.io' }
               }
           }
           .
           .
           .
           dependencies {
               implementation 'com.github.human-internet:humanid-android-sdk:0.0.4’
           }

2. Get Credentials

3. Configuration

Add this code to your AndroidManifest.xml. Make sure that all metadata is fulfilled.

<meta-data  
           android:name="com.humanid.sdk.applicationIcon"  
           android:resource="@drawable/ic_app_icon"/>
<meta-data
           android:name="com.humanid.sdk.applicationName"
           android:value="@string/app_name"/>
<meta-data  
           android:name="com.humanid.sdk.applicationId"
           android:value="YOUR_APP_ID"/>
<meta-data
           android:name="com.humanid.sdk.applicationSecret"
           android:value="YOUR_APP_SECRET"/>

4. Using the SDK in Kotlin

Add this code to your Activity or Fragment file. We recommend you wrap this in a function that handles the login button.

LoginManager.getInstance(this).registerCallback(object : LoginCallback {
               override fun onCancel() {  }

             override fun onSuccess(exchangeToken: String) {
                 //todo: send the exchangeToken to your server
               }

             override fun onError(errorMessage: String) {  }
             })
             ...
             ..
             .
             override
             fun onActivityResult(requestCode: Int, resultCode:Int, data: Intent?) {
               LoginManager.getInstance(this).onActivityResult(requestCode, resultCode, 
data)
               super.onActivityResult(requestCode, resultCode, data)
             }

5. Using the SDK in Java

Add this code to your Activity or Fragment file. We recommend you wrap this in a function that handles the login button.

LoginManager.INSTANCE.getInstance(this).registerCallback(new LoginCallback() {
               @Override
               public void onCancel() {}

             @Override
               public void onSuccess(@NotNull String exchangeToken) {
                 //todo: send the exchangeToken to your server
               }

             @Override
               public void onError(@NotNull String errorMessage) {}

           });
           ...
           ..
           .
           @Override
           protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent 
data) {
                LoginManager.INSTANCE.getInstance(this).onActivityResult(requestCode, 
resultCode, data);
                super.onActivityResult(requestCode, resultCode, data);
            }

6. You Are All Set!

Your Android app should now be integrated with the humanID login.

Sample

  • Warning! To run the example project, clone the repo, and run pod install from the Example directory first.

Get the clientID and clientSecret through the

See our Github for a full to learn more!

App Registration Form
sample
Requirements
Steps
Sample
Downloads
Get Credentials
Configuration
Using the SDK in Kotlin
Using the SDK in Java