You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently found an issue where our push notifications were no longer coming through in the foreground even while still using the notification_foreground data value. It turned out that this behavior started when we began using localization in our push notifications instead of providing fixed strings from the backend. The push notifications had the correct content when the app was not in the foreground, but would not appear at all when in the foreground. Looking deeper into this code I realized that it was not checking for the localization keys. Therefore, since we were not providing a title and body, but instead a title_loc_key and body_loc_key, the foreground logic was deciding not to show the foreground notification. See the links below for Firebase documentation and examples.
Feature request
I am requesting the localization fields be supported so that our notifications are consistent and displayed the same whether we are in the foreground or not. This will be beneficial for anyone who is using the localization to support multiple languages on the client side and also want to have working foreground notifications.
Missing keys from the foreground notification check:
title_loc_key
title_loc_args
body_loc_key
body_loc_args
Solution
I have just implemented a small fix for this on my own fork of this repo and it looks like it is working perfectly. Supporting messages with and without arguments. The logic is, if the localized versions of the title and body exist, use them instead, otherwise continue on as per normal. I will raise a PR shortly and link it here also.
PR #772 has now been raised.
Howdy!
Missing Feature / Bug
I recently found an issue where our push notifications were no longer coming through in the foreground even while still using the
notification_foreground
data value. It turned out that this behavior started when we began using localization in our push notifications instead of providing fixed strings from the backend. The push notifications had the correct content when the app was not in the foreground, but would not appear at all when in the foreground. Looking deeper into this code I realized that it was not checking for the localization keys. Therefore, since we were not providing atitle
andbody
, but instead atitle_loc_key
andbody_loc_key
, the foreground logic was deciding not to show the foreground notification. See the links below for Firebase documentation and examples.Feature request
I am requesting the localization fields be supported so that our notifications are consistent and displayed the same whether we are in the foreground or not. This will be beneficial for anyone who is using the localization to support multiple languages on the client side and also want to have working foreground notifications.
Missing keys from the foreground notification check:
title_loc_key
title_loc_args
body_loc_key
body_loc_args
Solution
I have just implemented a small fix for this on my own fork of this repo and it looks like it is working perfectly. Supporting messages with and without arguments. The logic is, if the localized versions of the title and body exist, use them instead, otherwise continue on as per normal. I will raise a PR shortly and link it here also.
PR #772 has now been raised.
Links
Android Notification object documentation
Cloud Messages with localization example
The text was updated successfully, but these errors were encountered: