Setting up Badges for React Native
How to implement Badges for your React Native project
Since the React Native plugin does not contain the PWNotificationExtensionManager header, you have to perform several additional steps to implement Badges for your React Native project.
That's what you need for setting Badges up:
To implement badges for iOS Native app, please refer to the Setting up Badges guide.
1. Add Notification Service Extension (File -> New -> Target...)
2. Select the "Notification Service Extension"
![](https://docs.pushwoosh.com/~gitbook/image?url=https%3A%2F%2F800539163-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LZcP-aO1PEwwePSSaCB-1260461824%252Fuploads%252FGsnjxHNxgeKcJkAYXjVt%252FScreenshot%25202022-03-29%2520at%252016.39.00.png%3Falt%3Dmedia%26token%3D0467b63d-5dd1-46c1-9c86-529d7e60330d&width=768&dpr=4&quality=100&sign=26f091a1&sv=1)
3. Update the Notification Service Extension code as follows:
Replace the name of extension used in the line #import "NotificationService.h"
with the name of your extension.
4. Link dependencies to a target
React Native does not automatically link all required dependencies to a target that was created manually, so you should update the target's Build Phases and provide the necessary info:
Just click on the + sign under the Compile Sources and Link Binary With Libraries and search for the required libs/frameworks.
5. Add App Groups capability to both targets in Xcode and set the same group for both app and extension:
6. Add the PW_APP_GROUPS_NAME key to info.plists of both targets. The value is the name of your app group:
Last updated