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?