3

I am trying to move from OneSignal to Firebase Cloud Messaging. The issue I am having is that I can't define a key value pair in the payload for localizing the notification. I have to define a key-value pair in my strings file in my app. This means the notifications can't be dynamic in that perspective if i want to send a whole different notification that isn't defined in the strings file.

When using OneSignal I could define the payload for localizing like this:

{
  'app_id': 'MY_APP_ID',
  'headings': {
               'en': 'The title in English', 
               'de': 'Die Überschrift in Deutsch'
              },

  'contents': {
               'en': 'The body in english', 
               'de': 'Der Inhalt in Deutsch'
              },
}

Is this somehow also possible for Cloud Messaging too?

SwiftiSwift
  • 7,528
  • 9
  • 56
  • 96

1 Answers1

0

For localizing messages sent to topics, check my answer here.

If you want to localize messages sent to individual devices/tokens I think the only way is to keep track of the ui language of the client associated with the token and do the localization server side before sending the notification.

icguy
  • 560
  • 4
  • 14