Customizing notifications

Batch allows you to customize your notifications adding specific keys to the payload or by setting some configuration in native code.

Advanced notification configuration is highly OS-specific and requires implementation at a lower level than Flutter.
Therefore, you might find what you want in the native documentations for each OS:

Showing foreground notifications on iOS

Notification behaviour when your app is in foreground depends on the OS:

  • On Android, the SDK will show notifications while the app is in foreground.
    If a Mobile Landing is attached, the SDK will display it immediatly unless this has explicitly been disabled using native code.
  • On iOS, the SDK follows iOS' default behavior which is not to display the notifications while the app is in foreground. This can be configured. If notifications are shown while the app is in foreground, Mobile Landings won't be immediatly shown.

The SDK exposes a method on BatchPush to change the behaviour on iOS:

// Make iOS behave like Android

Note: this requires your app to use BatchUNUserNotificationCenterDelegate as described in the native integration. If you made your own UNUserNotificationCenterDelegate subclass, the Dart API will not do anything and you will have to implement this manually.

Adding notification actions

Notification actions are supported but they integration differ greatly between iOS and Android. Please see the native documentations for more info:

Overriding the notification channel on Android

It is possible to override the default notification channel on Android either globally on a per notification basis.

As this is an operation that needs to be done by native code in the background when Flutter isn't running, please follow our native channels documentation.