Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>To my understanding, the only way to change the message send via a push notification before it gets displayed is using the "localization" mechanism.</p> <p>Have a look at the Apple's documentation about "Localized Formatted Strings": <a href="http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW21" rel="nofollow">http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW21</a></p> <p>I'm not really sure this is what you are trying to achieve.</p> <p>In my opinion, if you wan't to display different message/data wether your app is in background or in foreground, you should change the data sent via the push notification.</p> <p>Something like this:</p> <pre><code>{ "aps" : { "alert" : "Message displayed when app is in background" }, "foreground_alert" : "Another message or data used when app is in foreground" } </code></pre> <p>When your app is in background, the content of "alert" will be displayed automatically.</p> <p>When your app is in foreground, you will have to implement <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIApplicationDelegate/application%3adidReceiveRemoteNotification%3a" rel="nofollow">application:didReceiveRemoteNotification</a> to catch and handle the incoming notification (and display the content of "foreground_alert" by example)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload