LogoLogo
SDK ReferenceChangelogBlogStatusGet HelpGo To Dashboard
  • Introduction
  • Basics
    • How ContextDecision Works
    • How ContextPush Works
    • Getting Started
  • Context Decision
    • Logging Conversions
    • Revenue Outcomes
      • Logging Revenue with RevenueCat
    • Adding Entry Points
    • Release Checklist
    • Advanced
      • Custom Signals
      • Alternative Outcomes
      • Custom Outcome Metadata
      • Listening for Good Moments
      • Model Distribution Methods
      • Custom A/B Test Segmentation
      • Analytics & Reporting
  • Context Push
    • Integrating ContextPush
    • Push Notification Providers
      • OneSignal
      • Customer.io
      • Simple Web Request
    • Release Checklist
    • Analytics & Reporting
  • Discover By Use Cases
    • Multivariate Monetization
    • Inline Banners
  • Other Information
    • Glossary
    • Updating Your SDK
    • Minimum SDK Requirements
    • FAQ
    • Get Help
    • Changelog
  • Advanced
    • Custom Configuration
    • Capturing Context In Key Moments
Powered by GitBook
On this page
  • Sign Up and Create a License Key
  • SDK Integration
  • ContextDecision
  • ContextPush

Was this helpful?

  1. Basics

Getting Started

Get started with ContextSDK — sign up, create a license key, and integrate the SDK with step-by-step setup guides for all platforms.

PreviousHow ContextPush WorksNextLogging Conversions

Last updated 1 month ago

Was this helpful?

Sign Up and Create a License Key

To start using ContextSDK, sign up in our and create a license key for your app. This key is required to authenticate your integration with ContextDecision or ContextPush.

If your app has a different bundle ID or package name for different environments, register each one of them separately, as each environment will have a unique license key that should be used.

SDK Integration

Once you have your license key, integrate ContextSDK into your app. The following sections provide step-by-step instructions for iOS, Android, Flutter, Unity, and React Native.

Installation

Add https://github.com/context-sdk/context-sdk-releases.git as a dependency in Xcode Package Dependencies or in your Package.swift file:

dependencies: [
    .package(url: "https://github.com/context-sdk/context-sdk-releases", .upToNextMajor(from: "5.0.0")),
]

Add the following dependency to your Podfile and run pod install :

Podfile
pod "ContextSDK"
  1. Download the latest version of ContextSDK:

  2. In Xcode, drag ContextSDK.xcframework into the Project Navigator.

  3. Open your project settings, navigate to Frameworks, Libraries, and Embedded Content, add ContextSDK.xcframework, and set it to Embed & Sign.

SDK Initialization

AppDelegate.swift
import ContextSDK

class AppDelegate: NSObject, UIApplicationDelegate {
    // …
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        // …
        ContextManager.applicationDidFinishLaunchingWithOptions(launchOptions, licenseKey: "YOUR_LICENSE_KEY")
        // …
    }
}
  1. Create an AppDelegate class if you don't have one yet:

AppDelegate.swift
import ContextSDK

class AppDelegate: NSObject, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        ContextManager.applicationDidFinishLaunchingWithOptions(launchOptions, licenseKey: "YOUR_LICENSE_KEY")
        return true
    }
}
  1. If you didn't have an AppDelegate class yet, add a UIApplicationDelegateAdaptor property wrapper to your App scene:

YourApp.swift
struct YourApp: App {
    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
    // …
}

Installation

Note: Android support is currently in beta. To obtain a license key, contact us at support@contextsdk.com

Add the ContextSDK Maven repository in your project-level settings.gradle.kts:

settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        // …
        // Add the ContextSDK Maven repo:
        maven {
            url = uri("https://storage.googleapis.com/fc4073e9-contextsdk-maven/")
        }
    }
}

Add the ContextSDK dependency in your module-level build.gradle.kts:

build.gradle.kts
dependencies {
    // …
    implementation("com.contextsdk:contextsdk:1.0.0")
}

Add the ContextSDK Maven repository in your project-level settings.gradle:

settings.gradle
dependencyResolutionManagement {
    repositories {
        // …
        // Add the ContextSDK maven repo:
        maven {
            url 'https://storage.googleapis.com/fc4073e9-contextsdk-maven/'
        }
    }
}

Add the ContextSDK dependency in your module-level build.gradle:

build.gradle
dependencies {
    // …
    implementation 'com.contextsdk:contextsdk:1.0.0'
}

SDK Initialization

In your Application subclass, initialize ContextSDK by calling setup with your license key:

class MainApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        ContextSDK.setup(this, "YOUR_LICENSE_KEY")
    }
}

In your primary Activity subclass, or in every Activity in your application, allow ContextSDK to attach and detach:

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        ContextSDK.attachToActivity(this)
    }

    override fun onDestroy() {
        super.onDestroy()
        ContextSDK.detachFromActivity(this)
    }
}

In your Application subclass, initialize ContextSDK by calling setup with your license key:

public class MainApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        ContextSDK.Companion.setup(this, "YOUR_LICENSE_KEY", new ContextSDKConfiguration());
    }
}
  1. In your primary Activity subclass, or in every Activity in your application, allow ContextSDK to attach and detach:

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ContextSDK.Companion.attachToActivity(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ContextSDK.Companion.detachFromActivity(this);
    }
}

The Activity must conform to LifecycleOwner, such as AppCompatActivity. Standard Activity subclasses are not supported.

If ContextSDK is not set up correctly, it will be unable to start or stop collecting accelerometer and gyroscope data.

Installation

Add context_sdk to your pubspec.yaml:

pubspec.yaml
dependencies:
  context_sdk: ^latest_version

Ensure your project meets the Minimum SDK Requirements target by updating your ios/Podfile, e.g.:

ios/Podfile
platform :ios, "14.0"

SDK Initialization

Add the following code to your app’s launch:

import 'package:context_sdk/context_sdk.dart';

final _contextSdkPlugin = ContextSdk();

_contextSdkPlugin.setup("YOUR_LICENSE_KEY");

Installation

SDK Initialization

Set up the ContextManager in the Start() method of a MonoBehaviour that runs early in your game, before accessing the SDK:

using static ContextSDKBinding;

public class InitContextSDK : MonoBehaviour
{
    void Start()
    {
        ContextSDKBinding.SetupWithAPIBackend("YOUR_LICENSE_KEY");
    }
}

Installation

Install ContextSDK using your preferred package manager:

npm install react-native-context-sdk@latest

or

yarn add react-native-context-sdk

Ensure your project meets the Minimum SDK Requirements target by updating your ios/Podfile, e.g.:

ios/Podfile
platform :ios, "14.0"

SDK Initialization

Add the following code to your app’s launch:

import { setup } from "react-native-context-sdk";

void setup("YOUR_LICENSE_KEY");

ContextDecision

ContextPush

ContextPush improves the timing of non-transactional push notifications by leveraging user's real-life context. To begin integrating ContextPush, see Integrating ContextPush.

ContextDecision optimizes conversion funnels by intelligently determining the best moments to present monetization or engagement opportunities. Now that you’ve integrated ContextSDK, to get started with ContextDecision, see .

Logging Conversions
ContextSDK Console
ContextSDK.zip

To download a specific version, replace latest in the download URL with the desired version number. For example, to download version 5.5.0:

To download a specific version, replace latest in the download URL with the desired version number. For example, to download version 5.5.0:

https://storage.googleapis.com/de73e410-context-sdk-releases/5.5.0/ContextSDK.zip
https://storage.googleapis.com/de73e410-context-sdk-releases/5.5.0/ContextSDK.zip
  1. In your Unity project, drag ContextSDK.xcframework into the Assets/Plugins/iOS folder.

  2. Add the ContextSDKBinding.cs script in the same folder.

Download the latest version of ContextSDK: .

ContextSDK.zip