3

I would like to know what is the default behaviour of silent push notifications when the app is on foreground. Will it still display an alert view or not?

When localising the alert message :

"alert" : {
            "body" : "Start the game Jenna"
            "loc-key" : "start.game",
            "loc-args" : [ "Jenna"]
 }

Does the body message takes precedence over the loc-key? What if the loc-key does not exist on the app?

Michael Teper
  • 4,591
  • 2
  • 32
  • 49
apinho
  • 2,235
  • 3
  • 25
  • 39
  • Silent push notification = Contant-Avilable 1 ? – Asaf May 20 '15 at 15:19
  • Possible duplicate of [Change language of alert in banner of Push Notification](http://stackoverflow.com/questions/18609923/change-language-of-alert-in-banner-of-push-notification) – AechoLiu Mar 01 '16 at 07:45

2 Answers2

4

The docs imply that it's either/or: you should either set the body or the loc-key / loc-args properties.

Apple docs.

They might fall back to body if loc-key is not found, or they might never even look it up in Localizable.strings when body is present. Since docs don't define it, I would not count on the behavior one way or the other.

Daniel
  • 20,420
  • 10
  • 92
  • 149
Michael Teper
  • 4,591
  • 2
  • 32
  • 49
1

Just tested setting both body_loc_key and body

If the client doesn't have body_loc_key in it's Localizable.strings it will show the body text otherwise it will show the localized string of body_loc_key

Which is just what I want and probably what you would expect.

hansg
  • 51
  • 1