arrow-right-arrow-leftMigration Guide: Adding Extension

Migrate your existing ContextPush integration to use the required Notification Service Extension for reporting.

This guide walks you through adding the required Notification Service Extension to an existing ContextPush integration.

circle-info

Who should follow this guide? Developers who have already integrated ContextPush and need to add the required Notification Service Extension for reporting.

Overview

Adding required extension support involves three changes:

  1. Creating an App Group for data sharing

  2. Updating your main app initialization

  3. Adding the Notification Service Extension

Estimated time: 15-30 minutes

circle-exclamation

Before You Begin

Ensure you have:

  • ContextSDK version 5.13.0 or later

  • Working ContextPush integration in your main app

  • Access to Apple Developer Portal for App Group creation

Check Your SDK Version

Check your Podfile.lock for the ContextSDK version:

Update if needed:


Step 1: Create App Group

1

Register App Group

  1. Create a new App Group identifier (e.g., group.com.yourcompany.yourapp)

2

Add to Main App

  1. Open Xcode project settings for your main app target

  2. Go to Signing & Capabilities

  3. Add App Groups capability

  4. Select your app group


Step 2: Update Main App Initialization

Before (Current Code)

After (With App Group)

What Changed

Before
After

No configuration parameter

Configuration object with appGroupIdentifier

Data stored in app sandbox

Data shared via App Group

circle-exclamation

Step 3: Add Notification Service Extension

1

Create Extension Target

  1. FileNewTarget

  2. Select Notification Service Extension

  3. Name it (e.g., NotificationServiceExtension)

  4. Click Finish

2

Configure Extension

  1. Select extension target → Signing & Capabilities

  2. Add App Groups capability

  3. Select the same App Group as main app

3

Add Dependency

Update your Podfile:

Run:

4

Implement Extension

Replace NotificationService.swift:


Step 4: Verify Migration

Checklist

Test Delivery Tracking

  1. Force-quit your app completely

  2. Send a test notification from the dashboard

  3. Verify reporting events appear in analytics


FAQ

Will this affect existing users?

No. The migration is transparent to users. Existing notification behavior is unchanged - you're adding additional tracking capabilities.

What if the main app was never launched?

setupForExtension returns false if the main app hasn't stored the license token yet. The extension gracefully handles this by delivering the notification without tracking.

Do I need to update my push notification payloads?

No changes to your server-side push configuration are required.

What data is shared via the App Group?

  • License verification token (hash of license key)

  • Device token

  • User ID

  • APS environment (sandbox/production)

No sensitive user data or context is stored in the App Group.

Last updated

Was this helpful?