setForegroundDisplayPredicate method

Future<void> setForegroundDisplayPredicate(
  1. ForegroundDisplayPredicate? predicate
)

Overrides the foreground display per notification. The predicate should return quickly to avoid delaying notification delivery.

Implementation

Future<void> setForegroundDisplayPredicate(ForegroundDisplayPredicate? predicate) async {
  if (defaultTargetPlatform != TargetPlatform.android) {
    return;
  }

  _foregroundDisplayPredicate = predicate;
  await _module.channel.invokeMapMethod("push#android#isOverrideForegroundDisplayEnabled", {
    "enabled": (predicate != null)
  });
}