Getting Started
Requirements
Android
Minimum SDK Version
Ensure that your Android project has minSdkVersion set to 21 in your android/app/build.gradle file
android {
defaultConfig {
...
minSdkVersion 21
...
}
}Required Permissions
| Name | Description |
|---|---|
| CAMERA | Required to capture KTP and Selfie images. |
| INTERNET | Required to connect to backend services and upload documents |
| ACCESS_WIFI_STATE | Allows the application to check the state of Wi-Fi connectivity, ensuring smooth operation in network-dependent tasks. |
| ACCESS_NETWORK_STATE | Enables the application to monitor the device's overall network connectivity, allowing fallback mechanisms if the network state changes. |
Extract SDK
Extract the digital_identity_sdk.zip file. It contains:
- Flutter plugin in the
digital_identity_sdk_flutterdirectory. - Android-specific SDK in the
digital-identity-goto-220124.aarfile.
Add Android AAR
- In your Flutter application, open the
android/appdirectory. - Create a
libsdirectory insideandroid/app. - Open the project-level
build.gradlefile and register thelibsdirectory as a local repository:
allprojects {
repositories {
flatDir {
dirs 'libs'
}
google()
mavenCentral()
}
}- Open the app-level
build.gradlefile and add the AAR dependency:
dependencies {
implementation files('libs/digital-identity-goto-220124.aar')
}- Perform a Gradle sync.
iOS
Minimum iOS Version
Ensure that your iOS project supports iOS 12 or higher. Update your ios/Podfile to include the
following configuration:
platform :ios, '12.0'Info.plist Changes
Update the following keys in your Info.plist file:
- Camera Usage Description
To enable camera access
<key>NSCameraUsageDescription</key>
<string>Camera access is required for face and ID verification</string>
- LSApplicationQueriesSchemes
For security and jailbreak detection, add:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>zbra</string>
<string>cydia</string>
<string>undecimus</string>
<string>Sileo</string>
<string>filza</string>
</array>
Modify Client iOS Podfile
In the client app’s Podfile, merge the post_install block to include specific configurations for certain
targets. Add the following to the Podfile
# Merged post_install block
post_install do |installer|
installer.pods_project.targets.each do |target|
# Add additional flutter build settings
flutter_additional_ios_build_settings(target)
# Set BUILD_LIBRARY_FOR_DISTRIBUTION to YES for specific targets
if ["SwiftProtobuf", "ReachabilitySwift", "GRDB.swift", "Clickstream"].include?(target.name)
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
# Set IPHONEOS_DEPLOYMENT_TARGET for the Starscream target
if ["Starscream"].include?(target.name)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
end
This ensures the correct settings for the BUILD_LIBRARY_FOR_DISTRIBUTION and
IPHONEOS_DEPLOYMENT_TARGET for specific pods.
Add the Script to Copy Digital Identity Resources
- Create a new Run Script Phase in Xcode:
- Open your Runner.xcworkspace project in Xcode.
- Go to the Runner target.
- Select Build Phases.
- Click the + button and select New Run Script Phase.
- Name the script Copy Digital Identity Resources (or any name you prefer).
- Add the following script:
Developer Note: Replace the following line with the actual path to Digital Identity resources:
SOURCE_BUNDLE_PATH="/Users/shantaramkokate/Workspace/digital_identity_sdk_flutter
/ios/Frameworks/DigitalIdentityResources.bundle" # \<-- Update this path
Make sure to update the path with the correct location of DigitalIdentityResources.bundle in your
local development environment. This path is crucial for copying the bundle to the final build
during the iOS app's build process.
Script:
echo "DigitalIdentity: Starting build process"
# Developer Note: Replace the following line with the actual path to the Digital Identity
resources
SOURCE_BUNDLE_PATH="/Users/shantaramkokate/Workspace/digital_identity_sdk_flutter/ios/Frameworks/DigitalIdentityResources.bundle" # <-- Update this path
# Define the target path where the .bundle will be copied
RESOURCE_BUNDLE_PATH="${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/DigitalIdentityResources.bundle"
# Debug prints for paths
echo "DigitalIdentity: RESOURCE_BUNDLE_PATH = $RESOURCE_BUNDLE_PATH"
echo "DigitalIdentity: SOURCE_BUNDLE_PATH = $SOURCE_BUNDLE_PATH"
# Check if SOURCE_BUNDLE_PATH exists
if [ ! -e "$SOURCE_BUNDLE_PATH" ]; then
echo "DigitalIdentity: ERROR - Source bundle does not exist at $SOURCE_BUNDLE_PATH"
exit 1 # Exit the script with an error code
fi
# Check if RESOURCE_BUNDLE_PATH exists
if [ ! -e "$RESOURCE_BUNDLE_PATH" ]; then
echo "DigitalIdentity: DigitalIdentityResources.bundle not found at $RESOURCE_BUNDLE_PATH"
cp -R "$SOURCE_BUNDLE_PATH" "$RESOURCE_BUNDLE_PATH"
echo "DigitalIdentity: DigitalIdentityResources.bundle successfully copied to$RESOURCE_BUNDLE_PATH"
else
echo "DigitalIdentity: DigitalIdentityResources.bundle already exists at $RESOURCE_BUNDLE_PATH"
fi
Ensure the script is executed after the resources are copied.
- Place this script in the Copy Bundle Resources phase to ensure the .bundle is included in the
final build. - Final Steps
- Ensure that all resources are added to the target's Resources folder during the build.
- Test the integration by building the app and verifying that the .bundle file is included in
the final build output.
Installation Guide
Adding Dependencies:
To integrate the Digital Identity Sdk into your project, follow these steps:
- Copy the
digital_identity_sdk_flutterdirectory into your Flutter application - Open your project's
pubspec.yamlfile and add the following dependency:
dependencies:
digital_identity_sdk_flutter:
path: ../path_to_sdk
Initialize Digital Identity SDK
var digitalIdentitySdk = DigitalIdentitySdk(
environment: DigitalIdentitySdkEnvironment.staging, // Set the environment
analyticsCallback: _onEventFromDigitalIdentitySDK, // Analytics callback function
language: UserLanguage.indonesia, // Set the preferred language
);
Key Components
- environment: SDK supports different environments, staging or production environments.
- analyticsCallback: To track events from the SDK, implement the analyticsCallback function:
- language: The language setting of the KYC SDK, defined by the UserLanguage type.
Clear SDK Instance
Usage:
Future<bool> dispose() async { }
Call this method to release the SDK instance and free up resources. Reinitialization will be needed before
calling SDK launch methods.
Clear SDK Cache Data
Usage:
Future<bool> clearSdkCache() async { }
Call this method to clear the cache of the SDK. It is possible to call this method after dispose.
Updated 5 months ago