The preview Engage Mobile SDK provides a common API for registering APNs and FCM device tokens. The app obtains the token from the platform, then passes it to the SDK so Engage Studio can target the installation.
The SDK token-registration API is part of the preview Mobile SDK integration. Event names, field names, package distribution, and Push handling APIs may change before general availability.
The SDK handles the event that registers a token with the configured Records endpoint. The app remains responsible for the Push lifecycle.
| Responsibility | App | SDK |
|---|---|---|
| Request notification permission | ✓ | |
| Obtain an APNs or FCM token | ✓ | |
| Register the token with Treasure AI | Calls the SDK | ✓ |
| Receive a Push notification | ✓ | |
| Display a system notification | ✓ | |
| Handle a notification tap | ✓ | |
| Display a URL as Hosted Pages after a tap | Calls openUrl | Displays the WebView |
The SDK does not currently own the APNs or FCM receiver. Do not describe token registration as complete Push notification delivery.
Obtain the APNs token in the app and pass it to the SDK with the provider and destination table.
func application(
_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken token: Data
) {
TreasureData.sharedInstance().registerDeviceToken(
token,
provider: .apns,
table: "device_tokens"
)
}The app must request notification permission and register for remote notifications separately.
Obtain the FCM token from Firebase and pass it to the SDK with TDPushProvider.FCM.
override fun onNewToken(token: String) {
TreasureData.sharedInstance().registerDeviceToken(
token,
TDPushProvider.FCM,
"device_tokens"
)
}Call the method again when FCM refreshes the token. The app remains responsible for Firebase setup and notification permission handling.
The preview SDK registers a token as an event and flushes the event immediately. The Android M2 implementation uses the following fields:
{
"td_device_token": "<TOKEN>",
"td_push_provider": "fcm"
}The provider value is apns or fcm. The record has no separate event-name field. Optional parameters may be added by the app through the SDK API.
The existing Push Events Table describes a token_register event with an fcm_token field. The preview SDK record uses td_device_token and td_push_provider and adds no event-name field. Treat these as separate integration contracts until the standard Mobile Push event schema is finalized.
When the app receives a Push payload containing a URL, the app can pass the URL to the SDK:
TreasureData.sharedInstance().openUrl(
URL(string: "https://example.com/coupon")!,
context: ["coupon_id": "abc123"]
)TreasureData.sharedInstance().openUrl(
"https://example.com/coupon",
mapOf("coupon_id" to "abc123")
)This direct URL path does not have a campaign offer identity. It is displayed as a Hosted Pages WebView but does not create campaign impression, click, or dismiss events.
- Use a write-only API key for event ingestion.
- Do not log APNs or FCM tokens in production logs.
- Do not put API keys or Personalization tokens in Push payloads.
- Validate URLs before opening them as Hosted Pages.
- Validate Deep Links and app-owned routes before navigation.
- Apply your consent and privacy policy before registering a token or sending associated event data.