Skip to content

Commit fea4012

Browse files
authored
Updated documentation with notification_state event (multiple mobile apps)
1 parent 9c52053 commit fea4012

7 files changed

Lines changed: 173 additions & 5 deletions

File tree

Documentation/authorization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,6 @@ class ExampleAuthProvider : AuthorizationProvider {
173173
```kotlin
174174
configuration.applicationId = "<Your application id>"
175175
```
176-
Make sure your `applicationId` value matches exactly what you've defined in your Engagement project settings.
176+
Make sure your `applicationId` value matches exactly Application ID configured in your Bloomreach Engagement under **Project Settings > Campaigns > Channels > Push Notifications.**
177177

178178
**Single mobile app:** If your Engagement project supports only one app, you can skip the `applicationId` configuration. The SDK will automatically use the default value "default-application".

Documentation/firebase.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,15 @@ Next, you must create and register a service that extends `FirebaseMessagingServ
7474

7575
The SDK will only handle push notification messages sent from the Engagement platform. A helper method `Exponea.isExponeaPushNotification()` is also provided.
7676

77-
If you run the app, the SDK should the track push token to the Engagement platform. If you enabled the self-check, it will you inform you of this. Alternatively, you can find the customer in the Engagement web app and check the customer property `google_push_notification_id`.
77+
After running your application, the SDK tracks the push token to the Engagement platform. If you enabled the self-check feature, it will confirm successful tracking.
78+
You can also verify token tracking manually by locating the customer in the Bloomreach Engagement web application:
79+
80+
- **SDK versions below 4.6.0:** Check the customer property `google_push_notification_id`
81+
- **SDK versions 4.6.0 and higher:** Check the `notification_state` event with property `push_notification_token`
82+
83+
> ❗️Important
84+
>
85+
> SDK versions 4.6.0 and higher use event-based token tracking to support multiple mobile applications per project. Learn more about [Token tracking via notification_state event](https://documentation.bloomreach.com/engagement/docs/android-sdk-push-notifications#token-tracking-via-notification_state-event).
7886
7987
A push token is typically generated at the first application start, but it has its own lifecycle. Your `FirebaseMessagingService` implementation is triggered only if a token is created or its value has changed. Please validate your expectations against the defined [token update triggers](https://firebase.google.com/docs/cloud-messaging/android/client#sample-register)
8088

Documentation/huawei.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,15 @@ Next, you must create and register a service that extends `HmsMessageService`. T
8383

8484
The SDK will only handle push notification messages sent from the Engagement platform. A helper method `Exponea.isExponeaPushNotification()` is also provided.
8585

86-
If you run the app, the SDK should the track push token to the Engagement platform. If you enabled the self-check, it will you inform you of this. Alternatively, you can find the customer in the Engagement web app and check the customer property `huawei_push_notification_id`.
86+
After running your application, the SDK tracks the push token to the Engagement platform. If you enabled the self-check feature, it will confirm successful tracking.
87+
You can also verify token tracking manually by locating the customer in the Bloomreach Engagement web application:
88+
89+
- **SDK versions below 4.6.0:** Check the customer property `huawei_push_notification_id`
90+
- **SDK versions 4.6.0 and higher:** Check the `notification_state` event with property `push_notification_token`
91+
92+
> ❗️Important
93+
>
94+
> SDK versions 4.6.0 and higher use event-based token tracking to support multiple mobile applications per project. Learn more about [Token tracking via notification_state event](https://documentation.bloomreach.com/engagement/docs/android-sdk-push-notifications#token-tracking-via-notification_state-event).
8795

8896
A push token is typically generated at the first application start, but it has its own lifecycle. Your `HmsMessageService` implementation is triggered only if a token is created or its value has changed. Please validate your expectations against the defined [token update triggers](https://developer.huawei.com/consumer/en/doc/HMSCore-Guides/android-client-dev-0000001050042041#section487774626)
8997

Documentation/push-notifications.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ By default, the SDK tracks push notifications automatically. In the [SDK configu
9292

9393
If `automaticPushNotification` is enabled, the SDK will display push notifications from Engagement and track a "campaign" event for every delivered/opened push notification with the relevant properties.
9494

95+
> ❗️Important
96+
>
97+
> SDK versions 4.6.0 and higher use event-based token tracking to support multiple mobile applications per project. Learn more about [Token tracking via notification_state event](#token-tracking-via-notification_state-event).
98+
9599
### Respond to push notifications
96100

97101
When [creating a push notification](https://documentation.bloomreach.com/engagement/docs/mobile-push-notifications#creating-a-new-notification) in the Engagment web app, you can choose from three different actions to be performed when tapping the notification or additional buttons displayed with the notification.
@@ -249,6 +253,10 @@ Exponea.trackPushToken(
249253

250254
Invoking this method will track the push token immediately regardless of the [SDK configuration](https://documentation.bloomreach.com/engagement/docs/android-sdk-configuration) for `tokenTrackFrequency`.
251255

256+
> ❗️Important
257+
>
258+
> SDK versions 4.6.0 and higher use event-based token tracking to support multiple mobile applications per project. Learn more about [Token tracking via notification_state event](#token-tracking-via-notification_state-event).
259+
252260
#### Track delivered push notification
253261

254262
Use the [`trackDeliveredPush`](https://documentation.bloomreach.com/engagement/docs/android-sdk-tracking#track-push-notification-delivery-manually) method to manually track a delivered push notification:
@@ -356,6 +364,94 @@ Notification payloads use a JSON data structure.
356364
}
357365
```
358366

367+
## Token tracking via notification_state event
368+
369+
Starting with SDK version 4.6.0, push notification tokens are tracked using `notification_state` events instead of customer
370+
profile properties. This change enables support for multiple mobile applications per project,
371+
allowing you to track multiple push tokens for the same customer across different apps and devices.
372+
373+
### Token storage by SDK version
374+
375+
#### SDK versions below 4.6.0:
376+
377+
* Tokens are stored in customer profile properties: `google_push_notification_id` or `huawei_push_notification_id`
378+
* One token per customer profile
379+
* Single application per project
380+
381+
#### SDK versions 4.6.0 and higher:
382+
383+
* Tokens are stored as `notification_state` events
384+
* Multiple tokens per customer (grouped by Application ID)
385+
* Multiple applications per project supported
386+
* Backward compatibility maintained for Application ID `default-application`
387+
388+
### When notification_state events are tracked
389+
390+
The SDK automatically tracks `notification_state` events in the following scenarios:
391+
392+
* SDK initialization
393+
* App transitions from background to foreground
394+
* New token received from Firebase or Huawei
395+
* Manual token tracking using `Exponea.trackPushToken(...)` or `Exponea.trackHmsPushToken(...)`
396+
* User anonymization via `Exponea.anonymize()`
397+
* Notification permission requested via `Exponea.requestPushAuthorization(...)`
398+
399+
```kotlin
400+
Exponea.requestPushAuthorization(requireContext()) { granted ->
401+
Logger.i(this, "Push notifications are allowed: $granted")
402+
}
403+
```
404+
405+
The frequency of `notification_state` event tracking depends on the `tokenTrackFrequency` configuration property. [See SDK configuration](https://documentation.bloomreach.com/engagement/docs/android-sdk-configuration).
406+
407+
### notification_state event properties
408+
409+
| Property | Description | Example values |
410+
|-------------------------|------------------------------------------|-----------------------------------------|
411+
| `push_notification_token` | Current push notification token | Token string |
412+
| `platform` | Mobile platform | `android` or `huawei` |
413+
| `valid` | Token validity status | `true` or `false` |
414+
| `description` | Token state description | `Permission granted`, `Permission denied`, or `Invalidated` |
415+
| `application_id` | Application identifier from SDK configuration | Custom ID or `default-application` (default) |
416+
| `device_id` | Unique device identifier | UUID string |
417+
418+
> 📘 Note
419+
>
420+
> If you don't specify an `application_id` in your SDK configuration, the default value `default-application` is used. [See SDK configuration](https://documentation.bloomreach.com/engagement/docs/android-sdk-configuration).
421+
422+
### Understanding token states
423+
424+
The combination of `valid` and `description` properties indicates the token's current state:
425+
426+
| Valid | Description | When this occurs |
427+
|-------|---------------------|------------------------------------------------------------------------|
428+
| `false` | `Invalidated` | New token received \(old token becomes invalid\) or `Exponea.anonymize()` called |
429+
| `false` | `Permission denied` | [requirePushAuthorization](https://documentation.bloomreach.com/engagement/docs/android-sdk-configuration) is `true` and user denied notification permission |
430+
| `true` | `Permission granted` | Valid token tracked successfully \(all other cases\) |
431+
432+
### Configuring Application ID
433+
434+
> 📘 Note
435+
>
436+
> See this section to configure `application_id`. [Configure Application ID](https://documentation.bloomreach.com/engagement/docs/android-sdk-setup#configure-application-id).
437+
438+
> ❗️Important
439+
>
440+
> The SDK can automatically generate `notification_state` events,
441+
> but your Engagement project must have event creation enabled. If your project uses custom event schemas
442+
> or restricts event creation, add `notification_state` to the list of allowed events. Otherwise, push token registration will fail silently.
443+
444+
### Verifying token tracking
445+
446+
You can verify that tokens are being tracked correctly in the Bloomreach Engagement web application:
447+
448+
1. Navigate to Data & Assets > Customers
449+
2. Locate the customer profile
450+
3. Check for `notification_state` events in the customer's event history
451+
4. Verify the `push_notification_token` property contains a valid token value
452+
453+
For SDK versions below 4.6.0, check the customer profile properties `google_push_notification_id` or `huawei_push_notification_id` instead.
454+
359455
## Troubleshooting
360456

361457
> 📘

Documentation/setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Exponea.init(this, configuration)
9898
configuration.applicationId = "<Your application id>"
9999
```
100100

101-
Make sure your `applicationId` value matches exactly what you've defined in your Engagement project settings.
101+
Make sure your `applicationId` value matches exactly Application ID configured in your Bloomreach Engagement under **Project Settings > Campaigns > Channels > Push Notifications.**
102102

103103
**Single mobile app:** If your Engagement project supports only one app, you can skip the `applicationId` configuration. The SDK will automatically use the default value "default-application".
104104

Documentation/tracking.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ By default, the SDK tracks certain events automatically, including:
1313
* Installation (after app installation and after invoking [anonymize](#anonymize))
1414
* User session start and end
1515
* Banner event for showing an in-app message or content block
16+
* `notification_state` event for push notification token tracking (SDK versions 4.6.0 and higher). [Learn more](https://documentation.bloomreach.com/engagement/docs/android-sdk-push-notifications#token-tracking-via-notification_state-event).
1617

1718
Additionally, you can track any custom event relevant to your business.
1819

@@ -195,6 +196,22 @@ Invoking this method will cause the SDK to:
195196
* Preload in-app messages, in-app content blocks, and app inbox for the new customer.
196197
* Track a new `installation` event for the new customer.
197198

199+
#### How tokens are removed during anonymization
200+
201+
The SDK removes push notification tokens differently depending on the version:
202+
203+
**SDK versions below 4.6.0:**
204+
205+
- Assigns an empty string to the `google_push_notification_id` or `huawei_push_notification_id` customer property
206+
207+
**SDK versions 4.6.0 and higher:**
208+
209+
- Tracks a `notification_state` event with `valid = false` and `description = Invalidated`
210+
211+
> 📘 Note
212+
>
213+
> Learn more about [Token tracking via notification_state event](https://documentation.bloomreach.com/engagement/docs/android-sdk-push-notifications#token-tracking-via-notification_state-event).
214+
198215
You can also use the `anonymize` method to switch to a different Engagement project. The SDK will then track events to a new customer record in the new project, similar to the first app session after installation on a new device.
199216

200217
#### Examples
@@ -271,6 +288,10 @@ Invoking this method will track a push token immediately regardless of the value
271288

272289
Each time the app becomes active, the SDK calls `verifyPushStatusAndTrackPushToken` and tracks the token.
273290

291+
> 📘 Note
292+
>
293+
> SDK versions 4.6.0 and higher use event-based token tracking. Learn more about [Token tracking via notification_state event](https://documentation.bloomreach.com/engagement/docs/android-sdk-push-notifications#token-tracking-via-notification_state-event).
294+
274295
#### Arguments
275296

276297
| Name | Type | Description |

Documentation/version-update.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,42 @@ parentDocSlug: android-sdk-release-notes
88

99
This guide will help you upgrade your Exponea SDK to the latest major version.
1010

11+
## Update to version 4.6.0 or higher
12+
13+
SDK versions 4.6.0 and higher support multiple mobile applications within a single Bloomreach Engagement project.
14+
15+
This update introduces two major changes:
16+
17+
### 1. **Application ID configuration**
18+
19+
Each mobile application integrated with the SDK can now have its own unique `applicationId`. This identifier distinguishes between different applications within the same project.
20+
21+
**When to configure Application ID:**
22+
23+
- **Multiple mobile apps:** You must specify a unique `applicationId` for each app in the SDK configuration. The value must match the Application ID configured in Bloomreach Engagement under **Project Settings > Campaigns > Channels > Push Notifications.**
24+
- **Single mobile app:** If you use only one mobile application, you don't need to set `applicationId`. The SDK uses the default value `default-application` automatically.
25+
26+
Learn more about [SDK configuration](https://documentation.bloomreach.com/engagement/docs/android-sdk-configuration) and [Configure Application ID](https://documentation.bloomreach.com/engagement/docs/android-sdk-setup#configure-application-id).
27+
28+
### 2. **Push notification token tracking**
29+
30+
Push notification tokens are now tracked using `notification_state` events instead of customer properties (`google_push_notification_id` or `huawei_push_notification_id`). This change enables tracking multiple push tokens for the same customer across different applications and devices.
31+
32+
**Important prerequisites before upgrading:**
33+
34+
The SDK automatically generates `notification_state` events. Before upgrading to version 4.6.0 or higher:
35+
36+
- Ensure event creation is enabled for your Bloomreach Engagement project
37+
- If your project uses custom event schemas or restricts event creation, add `notification_state` to the list of allowed events
38+
- If your project blocks creation of new event types, push token registration will fail silently
39+
40+
**Symptoms of blocked event creation:**
41+
42+
- No new tokens appear in customer profiles or the event stream after SDK initialization
43+
- Push notifications are not delivered
44+
45+
Learn more about [Token tracking via notification_state event](https://documentation.bloomreach.com/engagement/docs/android-sdk-push-notifications#token-tracking-via-notification_state-event).
46+
1147
## Update from version 3.x.x to 4.x.x
1248

1349
Updating Exponea SDK to version 4 or higher requires making some changes related to in-app messages callback implementations.
@@ -182,4 +218,3 @@ has changed to
182218
> ❗️
183219
>
184220
> Invoking `Exponea.handleNewToken`, `Exponea.handleNewHmsToken`, and `Exponea.handleRemoteMessage` is allowed before SDK initialization in case it was initialized previously. In such a case, these methods will track events with the configuration of the last initialization. Please consider initializing the SDK in `Application::onCreate` to ensure a fresh configuration is applied in case of an update of your application.
185-

0 commit comments

Comments
 (0)