AppboyKit (also known as the Objective-C SDK) is no longer supported and has been replaced by the Swift SDK. It will no longer receive new features, bug fixes, security updates, or technical support—however, messaging and analytics will continue to function as normal. To learn more, see Introducing the New Braze Swift SDK.
Ignoring Braze internal push notifications
Braze uses silent push notifications for the internal implementation of certain advanced features. For most integrations, this requires no changes on your app’s behalf. However, if you integrate a Braze feature that relies on internal push notifications (for example, uninstall tracking or geofences), you may want to update your app to ignore our internal pushes.
If your app takes automatic actions on application launches or background pushes, you should consider gating that activity so that it’s not triggered by \ internal push notifications. For example, if you have logic that calls your servers for new content upon every background push or application launch, you likely would not want our internal pushes triggering that because you would incur unnecessary network traffic. Furthermore, because Braze sends certain kinds of internal pushes to all users at approximately the same time, not gating network calls on launch from internal pushes could introduce significant server load.
Checking your app for automatic actions
You should check your application for automatic actions in the following places and update your code to ignore our internal pushes:
- Push Receivers. Background push notifications will call
application:didReceiveRemoteNotification:fetchCompletionHandler:
on theUIApplicationDelegate
. - Application Delegate. Background pushes can launch suspended apps into the background, triggering the
application:willFinishLaunchingWithOptions:
andapplication:didFinishLaunchingWithOptions:
methods on yourUIApplicationDelegate
. You can check thelaunchOptions
of these methods to determine if the application has been launched from a background push.
Using Braze internal push utility methods
You can use the utility methods in ABKPushUtils
to check if your app has received or was launched by a Braze internal push. isAppboyInternalRemoteNotification:
will return YES
on all Braze internal push notifications, while isUninstallTrackingRemoteNotification:
and isGeofencesSyncRemoteNotification:
will return YES
for uninstall tracking and geofences sync notifications, respectively. Refer to ABKPushUtils.h
for method declarations.
Implementation example
1
2
3
4
5
6
7
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSDictionary *pushDictionary = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
BOOL launchedFromAppboyInternalPush = pushDictionary && [ABKPushUtils isAppboyInternalRemoteNotification:pushDictionary];
if (!launchedFromAppboyInternalPush) {
// ... Gated logic here (such as pinging your server to download content) ...
}
}
1
2
3
4
5
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
if (![ABKPushUtils isAppboyInternalRemoteNotification:userInfo]) {
// ... Gated logic here (such as pinging server for content) ...
}
}
1
2
3
4
5
6
7
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
let pushDictionary = launchOptions?[UIApplicationLaunchOptionsKey.remoteNotification] as? NSDictionary as? [AnyHashable : Any] ?? [:]
let launchedFromAppboyInternalPush = ABKPushUtils.isAppboyInternalRemoteNotification(pushDictionary)
if (!launchedFromAppboyInternalPush) {
// ... Gated logic here (such as pinging your server to download content) ...
}
}
1
2
3
4
5
6
7
func application(_ application: UIApplication,
didReceiveRemoteNotification userInfo: [AnyHashable : Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
if (!ABKPushUtils.isAppboyInternalRemoteNotification(userInfo)) {
// ... Gated logic here (such as pinging server for content) ...
}
}