How to clear badge count while app is foregrounded?

When calling:

const Expo = require('expo-server-sdk').default
const expo = new Expo()
expo.sendPushNotificationsAsync([{ to: "<push token>", badge: 0 }])

I can clear the number on the app icon. However this ONLY works if the app is not foregrounded. If this app is foregrounded this appears to have no effect.

So how can I clear the notifications badge when the app is foregrounded?

@jisaacks Hi, have you managed to resolve your problem? I have a similar problem where the badge counter is not clearing when the app is in foreground do you maybe have a solution yet? Thanks in advance