GaitAuth™ SDK Setup
Let’s walk through the initial steps of setting up the GaitAuth™ SDK.
Prerequisites
The GaitAuth Android SDK requires:
- Java 7 or greater
- Android API level 24 or greater
The GaitAuth iOS SDK requires:
- Swift 5.1 or greater
- iOS 10.0 or greater
- CocoaPods 1.10.0 or greater
Additionally, we recommend that you install the iOS SDK via CocoaPods, a dependency manager for iOS projects. Please refer to CocoaPods Guides - Getting Started for more information.
Installation and Setup
Android
Gradle Dependencies and Repositories
UnifyID Android SDKs are deployed to the Maven Central Repository. To easily include GaitAuth, first add mavenCentral()
to your top-level build.gradle
in both the buildscript
and allprojects
blocks, under repositories
:
buildscript {
repositories {
mavenCentral()
}
}
allprojects {
repositories {
mavenCentral()
}
}
Then, add the following to the dependencies
section in your module-level build.gradle
file:
// The dependencies block in the module-level build configuration file
// specifies dependencies required to build only the module itself.
dependencies {
implementation 'id.unify.sdk:sdk-gaitauth:1.3.19'
}
For more information about the Android build system, please refer to Android Studio - Configure your build.
To download the Android SDK directly, find us on GitHub at github.com/UnifyID/unifyid-android-sdk.
App Permissions and Auto Backup Settings
Prior to using the SDK, you’ll also want to make sure the following permissions are present in the root manifest
element of your AndroidManifest.xml
file:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Also, if Android Auto Backup is enabled in your project, you’ll want to add tools:replace="allowBackup"
under <application ...>
of your AndroidManifest.xml
:
<manifest ... >
<application
...
android:allowBackup="true"
<!-- Add following line -->
tools:replace="android:allowBackup"
...
>
...
</application>
<manifest ... >
Managing App Size
In order to keep your app as small as possible we recommend that you enable code and resource shrinking for your release build. To do so, add the following to your module-level build.gradle
file. You can read more about these optimizations here.
android {
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile(
'proguard-android-optimize.txt'),
'proguard-rules.pro'
}
}
...
}
iOS
Once CocoaPods is set up, you’ll want to add the GaitAuth SDK pod to your project:
- Add the GaitAuth SDK dependency to your
Podfile
:pod 'UnifyID/GaitAuth'
- Add a post install hook to ensure all dependent projects are built with library evolution support:
# Enable library evolution support on all dependent projects. post_install do |pi| pi.pods_project.targets.each do |t| t.build_configurations.each do |config| config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' end end end
- Install the pod:
$ pod install
- Open your project using the workspace file.
To download the SDK directly, find us on GitHub at github.com/UnifyID/unifyid-ios-sdk and check Releases.
Initializing the SDK
Don’t have an SDK Key yet? Learn how to create your first project.
Android
Initialize an instance of the SDK in your activity’s onCreate()
method:
UnifyID.initialize(getApplicationContext(), sdkKey, user, new CompletionHandler() {
@Override
public void onCompletion(UnifyIDConfig config) {
GaitAuth.initialize(getApplicationContext(), config);
}
@Override
public void onFailure(UnifyIDException e) {
// Initialization failed
}
});
iOS
Initialize an instance of the SDK in your root object or app delegate:
import UnifyID
let unifyid : UnifyID = { try! UnifyID(
sdkKey: "https://xxx@config.unify.id",
user: "unique-immutable-user-identifier"
)}()
Once the SDK is initialized, you’ll access GaitAuth functionality through its gaitAuth
instance:
import GaitAuth
let gaitAuth = unifyid.gaitAuth
The sdkKey
and user
Parameters
The sdkKey
resembles a URL and is found in the Settings section of the UnifyID Developer Dashboard.
The user
that you provide during SDK initialization should be a unique, immutable identifier for your user. While this identifier is treated as an opaque string, we highly recommend that you choose a value that does not reveal any additional information about the user. This includes emails, phone numbers, or any other Personally Identifiable Information.
Please make sure that the user
identifier is unique across all users and also does not change for a given user.
Next Steps
Now that you have the GaitAuth SDK initialized, you’re ready to move on to creating and training models for your users.