Skip to content

Context Decision

Context Decision helps you increase your app's revenue by showing the right prompts and messages at the right time.

Overview

  • Step 1: Add ContextSDK to your app
  • Step 2: Ship app into production in Calibration Mode
  • Step 3: Once the model is ready, you can start making decisions based on the SDK's predictions

Impact on your app

Less than 0.2% CPU Usage

0.6 MB Memory Usage

Adds less than 700kb to your app's binary size

No PII processed or stored

No app permissions required

Operates without ATT

Installation

Add https://github.com/context-sdk/context-sdk-releases as dependency.

Add the following dependency to your Podfile and run pod install

pod 'ContextSDK'

  1. Download the latest release: https://storage.googleapis.com/de73e410-context-sdk-releases/latest/ContextSDK.zip
  2. Drag & Drop the ContextSDK.xcframework folder into the Xcode file list
  3. Go to your project settings, scroll down to Frameworks, Libraries, and Embedded Content, add ContextSDK.xcframework, and select Embed & Sign

If you want to download a specific version, you can replace latest with the desired version number, e.g. https://storage.googleapis.com/de73e410-context-sdk-releases/3.1.0/ContextSDK.zip

Step 1: Add the ContextSDK maven repository in your project level settings.gradle.kts file:

dependencyResolutionManagement {
    repositories {
        ...

        // Add the ContextSDK maven repo:
        maven {
            url = uri("https://storage.googleapis.com/fc4073e9-contextsdk-maven/")
        }
    }
}

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

dependencies {
  ...

  implementation("com.contextsdk:contextsdk:1.0.0")
}

Step 1: Choose your preferred package manager:

npm install react-native-context-sdk@latest
yarn add react-native-context-sdk

Step 2: Ensure minimum Deployment Target

ContextSDK requires a minimum deployment target of iOS 14.0, be sure to update your ios/Podfile to specify 14.0 or higher:

platform :ios, '14.0'
  1. Download the latest version of ContextSDK: https://storage.googleapis.com/de73e410-context-sdk-releases/latest/ContextSDK.zip
  2. Drag & drop the ContextSDK.xcframework into the Assets/Plugins/iOS folder of your Unity project
  3. Add the ContextSDKBinding.cs script next to it
  1. Add context_sdk to your pubspec.yaml

  2. Ensure minimum Deployment Target is iOS 14.0 or higher. Be sure to update your ios/Podfile to specify 14.0 or higher:

platform :ios, '14.0'

License Key

After you installed ContextSDK, you need to add your license key. Register here to get started.

In your willFinishLaunchingWithOptions: (or anywhere before you access the SDK) setup the ContextManager:

AppDelegate.swift
import ContextSDK
AppDelegate.swift willFinishLaunchingWithOptions:
ContextManager.setup("YOUR_LICENSE_KEY")
  1. Create a new custom Swift class named AppDelegate.swift
    AppDelegate.swift
    import ContextSDK
    
    class AppDelegate: NSObject, UIApplicationDelegate {
        func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
            ContextManager.setup("YOUR_LICENSE_KEY")
            return true
        }
    }
    
  2. In your App scene UIApplicationDelegateAdaptor property wrapper
    struct YourApp: App {
        @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
        // ...
    }
    

Note: Android is still in beta - to obtain a license key contact us at support@contextsdk.com

  1. In your Application sub-class call the following code:
class MainApplication : Application() {

    override fun onCreate() {
        super.onCreate()
        ContextSDK.setup(this, "YOUR_LICENSE_KEY_HERE")
    }
}
  1. 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)
  }
}
  1. In your Application sub-class call the following code:
public class MainApplication extends Application {

  @Override
  public void onCreate() {
    super.onCreate();
    ContextSDK.Companion.setup(this, "YOUR_LICENSE_KEY_HERE", 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);
  }
}

Notes:

  • If the above isn't setup correctly, ContextSDK won't be able to start and stop collection of accelerometer & gyroscope data.
  • The Activity must conform to LifecycleOwner (e.g. AppCompatActivity). Plain Activities are not supported.

Call the following code on app start:

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

void setup("YOUR_LICENSE_KEY_HERE");

In the Start() of a MonoBehaviour that is run early in your game (or anywhere before you access the SDK) setup the ContextManager:

InitContextSDK.cs
using static ContextSDKBinding;

public class InitContextSDK : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        ContextSDKBinding.SetupWithAPIBackend("YOUR_LICENSE_KEY");
    }
}

Call the following code on app start:

import 'package:context_sdk/context_sdk.dart';

final _contextSdkPlugin = ContextSdk();

_contextSdkPlugin.setup("YOUR_LICENSE_KEY_HERE");

Get Started with Context Decision

Choose your platform to get started: