setForegroundNotificationPresentationOptions method
Sets the presentation options for Apple notifications when received in the foreground.
By default, on Apple devices notification messages are only shown when the application is in the background or terminated. Calling this method updates these options to allow customizing notification presentation behavior whilst the application is in the foreground.
Important: The requested permissions and those set by the user take priority over these settings.
alertCauses a notification message to display in the foreground, overlaying the current application (heads up mode).badgeThe application badge count will be updated if the application is in the foreground.soundThe device will trigger a sound if the application is in the foreground.
If all arguments are false or are omitted, a notification will not be displayed in the
foreground, however you will still receive events relating to the notification.
Important: Options set to true are persisted. If you
later remove or comment out this call, those values remain in effect—they are not reset to
false. To turn off foreground display after having set it to true, call this method
explicitly with alert: false (and badge/sound as desired).
Implementation
Future<void> setForegroundNotificationPresentationOptions({
bool alert = false,
bool badge = false,
bool sound = false,
}) {
return _delegate.setForegroundNotificationPresentationOptions(
alert: alert,
badge: badge,
sound: sound,
);
}