Custom Configuration
Learn how to tailor ContextSDK settings to suit your app's unique needs.
ContextSDK operates seamlessly in the background, designed from the ground up to minimize resource usage and have no impact on your app’s performance. For most use cases, we recommend keeping the default settings unless you have specific requirements.
If needed, you can customize these options by passing a Configuration object to the applicationDidFinishLaunchingWithOptions method, as seen here:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// …
let config = Configuration(…)
ContextManager.applicationDidFinishLaunchingWithOptions(launchOptions, licenseKey: "YOUR_LICENSE_KEY", configuration: config)
// …
}Configuration Options
App Group Identifier
The appGroupIdentifier enables data sharing between your main app and a Notification Service Extension. This allows the extension to verify your license and share user preferences.
let config = Configuration(appGroupIdentifier: "group.com.yourcompany.yourapp")Requirements:
Both main app and extension must have the App Groups capability enabled
Both must use the same App Group identifier
The main app must be launched at least once after configuration to initialize shared data
See Notification Service Extension for complete setup instructions.
Session Timeout
ContextSDK groups events into sessions using a simple, timeout-based model. A session lasts while your app is in the foreground and stays the same across brief background/foreground transitions (for example, when the user pulls down the notification shade). It only rolls over to a new session when the app returns to the foreground after being in the background for at least sessionTimeoutSeconds (or after the app is relaunched).
The default timeout is 5 minutes (300 seconds). You can override it:
Values of 0 or less are ignored, and the default is used instead.
For a comprehensive list of all configuration options, please refer to our iOS SDK Reference (Configuration).
Last updated
Was this helpful?