Skip to main content

Native Apps

The DataSapien Mobile SDK is available for iOS and Android native apps. Android and iOS SDKs provide the same set of functionality.

iOS

The iOS SDK is available as an SPM package that you can reference in an Xcode project. DataSapien iOS Mobile SDK is developed using Swift.

Prerequisites

Before getting started, ensure your development environment meets the following prerequisites:

  • Xcode 14.1-14.3.1 with a target of iOS 11.0 or higher
  • Reflection is enabled in your project. The Swift SDK uses reflection to determine your model's properties. Your project must not set SWIFT_REFLECTION_METADATA_LEVEL = none, or the SDK cannot see properties in your model. Reflection is enabled by default if your project does not specifically set a level for this setting.
  • Set up a physical Apple device or use a simulator to run your app.

Additionally, you must configure App Transport Security (ATS):

  • Either allow arbitrary loads (development only) or
  • Add your DataSapien backend domain(s) under NSExceptionDomains in your Info.plist.

Step 1: Register DataSapien project (Beta)

Before you can add Mobile SDK to your iOS app, you need to create your account and logging into the Orchestrator using your registered domain.

Your authentication keys and host URLs will be provided after registration.

Step 3: Add DataSapien iOS SDK to your app

SPM Installation

Swift Package Manager is available for DataSapien SDK. Framework can be added as a dependency by using SPM. Details blow:

  1. In Xcode, go to File → Add Packages…
  2. Enter SPM URL:
https://github.com/Data-Sapien/DSSDK-Core-Release
  1. Select the branch matching your Xcode version:
  • xcode-16-2 for Xcode 16.2
  • xcode-16-4 for Xcode 16.4+
  1. Build the project

Step 4: Initialize SDK in your app

  1. To initialize SDK you must modify your Application Delegate. Inside the application didFinishLaunchingWithOptions add the following code to import the Mobile SDK:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {    

let config = DataSapienConfig
.Builder()
.setAuth(
url: "<AUTH_URL>",
clientId: "<CLIENT_ID>",
clientSecret: "<CLIENT_SECRET>",
scope: "<SCOPE>"
)
.setHost(
baseUrl: "<BASE_URL>",
mediaUrl: "<MEDIA_URL>"
)
.setdebug(true) // Optional debug logs
.build()

DataSapien.initialize(dataSapienConfig: config)

DataSapien.setup { result in //Result<Void, Error>
// Optional: handle success/error
}

return true
}

You can obtain the required configuration keys by contacting the DataSapien team. We recommend calling DataSapien.setup() at each app launch because the SDK fetches only optimized deltas.

Android

The Android SDK is available in Maven that you can reference in a Gradle based project. DataSapien Android Mobile SDK is developed using Kotlin.

Prerequisites

Before getting started, ensure your development environment meets the following prerequisites:

  • Android Studio Bumblebee 2021.1.1 or higher.
  • JDK 11 or higher.
  • Kotlin Plugin for Android Studio, version 1.6.10 or higher.
  • An Android Virtual Device (AVD) using a supported CPU architecture.
Contact Us

Additional documentation is available on request. Contact us for further information.

Step 1: Register DataSapien project (Beta)

Before you can add Mobile SDK to your Android app, you need to request an enterprise project to connect to your app. Visit TODO.

Step 2: Add a DataSapien configuration file (Beta)

To use Mobile SDK in your Android app, you need to register your app with your DataSapien Enterprise project. Configuration file contains:

  • Enabled Module List
  • License
  1. Create DS-Info.plist to obtain your Firebase Apple platforms config file (DS-Info.plist).
  2. Move your config file into the module (app-level) root directory of your app.

If you have multiple bundle IDs in your project, you must associate each bundle ID with the configuration file.

Step 3: Add DataSapien SDK to your app

If you want to import the SDK without using Maven you can import the framework manually. Details below:

  1. Download the latest SDK version.
  2. Extract the framework from the zip file.
  3. Copy DSSDK.aar file to your project’s /lib folder (if you don’t have it, create the folder first)
  4. Add SDK to your application’s build.gradle:`
dependencies {
implementation files('libs/DSSDK.aar')
}
  1. Add Google Play Services to your build.gradle:
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
}

dependencies {
implementation 'com.google.android.gms:play-services-ads-identifier:17.1.0'
}

Step 4: Initialize SDK in your app

  1. To initialize SDK you must modify your main Activity’s onCreate() method
import com.datasapien.ds

DS.connect(getApplicationContext(), "SDK_KEY_GOES_HERE", new DSConnectionListener() {

@Override
public void onConnectSuccess() {
this.onConnectSuccess();
}

@Override
public void onConnectFailure() {
this.onConnectFailure();
}
});