Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Commit c3b0d84

Browse files
authored
Update sdk-react-native.mdx
1 parent 24778e4 commit c3b0d84

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

fern/docs/pages/plug-sdk/sdk-react-native.mdx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,47 @@ DevRevSDK.unregisterDevice(deviceID: string)
255255
The method requires the device identifier, which should be the same as the one used when registering the device.
256256

257257

258+
### Processing push notifications
258259

260+
#### Android
259261

262+
On Android, notifications are implemented as data messages to offer flexibility. However, this means that automatic click processing isn't available. To handle notification clicks, developers need to intercept the click event, extract the payload, and pass it to a designated method for processing. This custom approach enables tailored notification handling in Android applications.
260263

264+
To process the notification, use the following method:
265+
266+
```typescript
267+
DevRevSDK.processPushNotification(payload: string)
268+
```
269+
270+
Here, the `message` object from the notification payload should be passed to this function.
271+
272+
For example:
273+
274+
```typescript
275+
const notificationPayload = {
276+
// message may be nested based on the notification library
277+
"message": {
278+
// ... (the entire message object)
279+
}
280+
};
281+
const messageJson = notificationPayload["message"];
282+
DevRevSDK.processPushNotification(JSON.stringify(messageJson));
283+
```
284+
#### iOS
285+
286+
On iOS devices, you must pass the received push notification payload to the DevRev SDK for processing. The SDK will then handle the notification and execute the necessary actions.
287+
288+
```typescript
289+
DevRevSDK.processPushNotification(payload: string)
290+
```
291+
292+
For example:
293+
294+
```typescript
295+
DevRevSDK.processPushNotification(JSON.stringify(payload));
296+
```
297+
298+
## License
299+
300+
Apache 2.0
261301

0 commit comments

Comments
 (0)