You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -32,10 +35,74 @@ The SDK integrates Firebase Cloud Messaging (FCM) to deliver push notifications
32
35
|`google-services.json`| Place in your app module root; required for FCM token acquisition |
33
36
|`com.google.gms:google-services` plugin | Apply in your app-level `build.gradle.kts`|
34
37
|`PushNotificationInterface` implementation | Register via `SalesforceSDKManager.getInstance().pushNotificationReceiver`|
38
+
|`POST_NOTIFICATIONS` permission | Required for Android 13+ (API 33+); declare in manifest and request at runtime |
35
39
| External Client App | Connected app with push notification endpoint enabled in your Salesforce org |
36
40
37
41
---
38
42
43
+
## Setup
44
+
45
+
### 1. Add google-services.json
46
+
47
+
Download `google-services.json` from the [Firebase Console](https://console.firebase.google.com/) and place it in your app module directory (e.g. `app/`).
That is all. `SFDCFcmListenerService` (declared in the SDK's own `AndroidManifest.xml`) handles FCM token acquisition, Salesforce device registration, decryption, and re-registration automatically.
103
+
104
+
---
105
+
39
106
## Architecture
40
107
41
108
```
@@ -183,14 +250,89 @@ Encryption scheme: RSA-OAEP-SHA256 wrapping a 128-bit AES key + 128-bit IV.
183
250
Serializable data class modelling the Salesforce actionable notification payload under the `sfdc` key.
184
251
185
252
```kotlin
186
-
data classSalesforceActionableNotificationContent(valsfdc:Sfdc?)
253
+
@Serializable
254
+
data classSalesforceActionableNotificationContent(valsfdc:Sfdc?) {
// use notificationId with SalesforceSDKManager.invokeServerNotificationAction(...)
288
+
}
192
289
```
193
290
291
+
**Note on `Act`:**`sfdc.act?.group` is a string identifier that matches `notificationType.actionGroups[].name` — the action *buttons* (with `label` and `actionKey`) live on the notification type fetched from the API, not inside the `act` field of the incoming payload.
292
+
293
+
---
294
+
295
+
### `NotificationsApiClient`
296
+
297
+
REST client for the Salesforce Notifications API (requires API v64.0+).
For React Native apps, the setup is identical to the native Android setup above, with one substitution: use `SalesforceReactSDKManager.getInstance()` in place of `SalesforceSDKManager.getInstance()`:
324
+
325
+
```kotlin
326
+
// In MainApplication.onCreate(), after SalesforceReactSDKManager.initReactNative(...)
There is no JavaScript push bridge — the `react-native-force` package does not export a push module. See [`SalesforceMobileSDK-ReactNative/docs/push/README.md`](https://github.com/forcedotcom/SalesforceMobileSDK-ReactNative/tree/dev/docs/push) for guidance on forwarding push payloads to the JavaScript layer via a custom event emitter.
335
+
194
336
---
195
337
196
338
## Registration Lifecycle
@@ -282,14 +424,105 @@ No app-side configuration is required beyond normal SDK setup.
282
424
283
425
---
284
426
427
+
## Actionable Notifications
428
+
429
+
Requires Salesforce API version **v64.0 or later**.
430
+
431
+
After successful device registration, the SDK automatically fetches notification types from `GET /vXX.0/connect/notifications/types` and stores them per user. It creates one `NotificationChannel` per Salesforce notification type (channel ID = `notificationType.type`, importance `HIGH`), grouped under a `NotificationChannelGroup` named `"Salesforce Notifications"`.
432
+
433
+
Actionable notifications require three collaborating pieces:
434
+
435
+
1.**Payload parsing** — parse `"content"` in `onPushMessageReceived`, look up the notification type by `notifType`.
436
+
2.**Notification building** — construct a `NotificationCompat` with action buttons sourced from the notification type's `actionGroups`.
437
+
3.**Action handling** — a `BroadcastReceiver` receives the `PendingIntent` when the user taps a button and calls `invokeServerNotificationAction`.
Register the receiver in `Application.onCreate()` (not in the manifest — use `RECEIVER_NOT_EXPORTED` to prevent external apps from sending intents to it):
505
+
506
+
```kotlin
507
+
ContextCompat.registerReceiver(
508
+
this,
509
+
PushActionReceiver(),
510
+
IntentFilter("com.example.PUSH_ACTION"),
511
+
ContextCompat.RECEIVER_NOT_EXPORTED
512
+
)
513
+
```
514
+
515
+
---
516
+
285
517
## Testing
286
518
287
-
Push notification tests are in `libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/`:
519
+
Push notification tests are in `libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/`:
0 commit comments