Push notifications
Learn how to integrate push notifications for the Cordova Braze SDK, including rich push notifications and push stories.
Prerequisites
Before you can use this feature, you’ll need to integrate the Braze Cordova SDK into your app. After you integrate the SDK, basic push notification functionality is enabled by default. To use rich push notifications and push stories, you’ll need to set them up individually.
Anytime you add, remove, or update your Cordova plugins, Cordova will overwrite the Podfile in your iOS app’s Xcode project. This means you’ll need to set these features up again anytime you modify your Cordova plugins.
Setting up rich push notifications
Step 1: Create a notification service extension
In your Xcode project, create a notification service extension. For a full walkthrough, see iOS Rich Push Notifications Tutorial.
Step 2: Add a new target
Open your Podfile and add BrazeNotificationService
to the notification service extension target you just created. If BrazeNotificationService
is already added to a target, remove it before continuing. To avoid duplicate symbol errors, use static linking.
1
2
3
4
target 'NOTIFICATION_SERVICE_EXTENSION' do
use_frameworks! :linkage => :static
pod 'BrazeNotificationService'
end
Replace NOTIFICATION_SERVICE_EXTENSION
with the name of your notification service extension. Your Podfile should be similar to the following:
1
2
3
4
target 'MyAppRichNotificationService' do
use_frameworks! :linkage => :static
pod 'BrazeNotificationService'
end
Step 3: Reinstall your CocoaPods dependencies
In the terminal, go to your project’s iOS directory and reinstall your CocoaPod dependencies.
1
2
cd PATH_TO_PROJECT/platform/ios
pod install
Setting up push stories
Step 1: Create a notification content extension
In your Xcode project, create a notification content extension. For a full walkthrough, see iOS Push Stories Tutorial.
Step 2: Configure your push app group
In your project’s config.xml
file, configure the push app group you just created.
1
<preference name="com.braze.ios_push_app_group" value="NOTIFICATION_CONTENT_EXTENTION" />
Replace PUSH_APP_GROUP
with the name of your push app group. Your config.xml
should be similar to the following:
1
<preference name="com.braze.ios_push_app_group" value="MyPushAppGroup" />
Step 3: Add a new target
Open your Podfile and add BrazePushStory
to the notification content extension target you created previously. To avoid duplicate symbol errors, use static linking.
1
2
3
4
target 'NOTIFICATION_CONTENT_EXTENSION' do
use_frameworks! :linkage => :static
pod 'BrazePushStory'
end
Replace NOTIFICATION_CONTENT_EXTENSION
with the name of your notification content extension. Your Podfile should be similar to the following:
1
2
3
4
target 'MyAppNotificationContentExtension' do
use_frameworks! :linkage => :static
pod 'BrazePushStory'
end
Step 4: Reinstall your CocoaPods dependencies
In the terminal, go to your iOS directory and reinstall your CocoaPod dependencies.
1
2
cd PATH_TO_PROJECT/platform/ios
pod install
Disabling basic push notifications (iOS only)
After you integrate the Braze Cordova SDK for iOS, basic push notification functionality is enabled by default. To disable this functionality in your iOS app, add the following to your config.xml
file. For more information, see Optional configurations.
1
2
3
4
<platform name="ios">
<preference name="com.braze.ios_disable_automatic_push_registration" value="NO" />
<preference name="com.braze.ios_disable_automatic_push_handling" value="NO" />
</platform>