# Flutter FCM onMessage are executed in Android, but they are not executed in iOS

**URL:** <https://community.sendbird.com/t/flutter-fcm-onmessage-are-executed-in-android-but-they-are-not-executed-in-ios/8198>\
**Category:** Flutter\
**Created:** [September 5, 2023, 5:10am UTC](https://community.sendbird.com/t/flutter-fcm-onmessage-are-executed-in-android-but-they-are-not-executed-in-ios/8198 "2023-09-05T05:10:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tommy](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tommy/32/4390_2.png) [@Tommy](https://community.sendbird.com/u/Tommy)\
**Post date:** [September 5, 2023, 5:10am UTC](https://community.sendbird.com/t/flutter-fcm-onmessage-are-executed-in-android-but-they-are-not-executed-in-ios/8198/1 "2023-09-05T05:10:16Z")

</div>

When a notification is received, onBackgroundMessage and onMessage are executed in Android, but they are not executed in iOS. While I can ensure that heads-up notifications are always displayed in the foreground using the setForegroundNotificationPresentationOptions method, I want to show heads-up notifications conditionally through onMessage. How can I achieve this?

related issue:

> [@Push Notification using FCM in Flutter(iOS)](https://community.sendbird.com/t/push-notification-using-fcm-in-flutter-ios/3335):
>
> Hello, I am trying to send Push Notification to our Flutter App using FCM. While it is working fine with Android, it does not work with iOS. I believe the problem is that Sendbird does not send “content\_available” parameter in the notification payload. Due to this the onBackgroundMessage callback does not run, which in turn does not show the notification in the App. Please be informed that I am using flutter\_local\_notifications along with firebase\_messaging plugins. I want to know if someone e…
