firebase icon indicating copy to clipboard operation
firebase copied to clipboard

[firebase-messaging] Missing 'foreground' property in onMessage callback on Android

Open prestopasto opened this issue 2 years ago • 1 comments

In many instances it is desirable to handle notifications differently depending on if the message was received while the app is in the foreground vs when it is in the background. There is currently no way to determine this right now.

The old Firebase plugin by Eddy had a 'foreground' boolean property to accomplish this. Then in the 'onMessage' callback you could decide how to handle it.

https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/master/docs/MESSAGING.md

prestopasto avatar Feb 09 '23 19:02 prestopasto

@prestopasto now you can use MessagingCore.inForeground for manage this

https://github.com/NativeScript/firebase/blob/main/packages/firebase-messaging/README.md#foreground-state-messages

Added in this PR https://github.com/NativeScript/firebase/pull/193

vallemar avatar Apr 06 '23 11:04 vallemar