Will iOS Awake My App When I Receive Silent Push Notification(When App Is Not in Running State)

Is a iOS silent notification received when the app is killed

Short answer is: no, you cannot.

You also won't be able to use VoIP pushes, the only option would be to use regular pushes with a push notification service extension. Share a keychain between your app and this extension, save the push payload in the keychain when receiving a notification and retrieve it with your app when it enters foreground.
Downside is you will need to present a visual notification to the user, but it can be silent, and you can choose to present whatever text you want (the best option will depend on what your app does and what's the purpose of this notification).

What is Silent Push Notification? When does the device receive it?

They can be used to inform the application of new content without having the user informed. Instead of displaying a notification alert, the application will be awakened in background (iOS does not automatically launch your app if the user has force-quit it) and application:didReceiveRemoteNotification:fetchCompletionHandler: will be called. You then have the opportunity to process any information transparently for the user :

  • Download some content
  • Synchronize some elements,
  • Inform the user directly within the application when he opens it back

Note that your time is limited to 30s.

To configure silent notifications

To support silent remote notifications, add the remote-notification value to the UIBackgroundModes array in your Info.plist file. To learn more about this array, see UIBackgroundModes.

<key>UIBackgroundModes</key>
<array>
    <string>remote-notification</string>
</array>

Configuring a Silent Notification

The aps dictionary can also contain the content-available property. The content- available property with a value of 1 lets the remote notification act as a silent notification. When a silent notification arrives, iOS wakes up your app in the background so that you can get new data from your server or do background information processing. Users aren’t told about the new or changed information that results from a silent notification, but they can find out about it the next time they open your app.

For a silent notification, take care to ensure there is no alert, sound, or badge payload in the aps dictionary. If you don’t follow this guidance, the incorrectly-configured notification might be throttled and not delivered to the app in the background, and instead of being silent is displayed to the user

Can Apple's silent push notifications launch my app in the background?

When the device receives a push message with content-available set, your app gets launched in the background by Apple. Users won't be aware of it. From the docs:

content-available: Provide this key with a value of 1 to indicate that new content is available. Including this key and value means that when your app is launched in the background or resumed, -application:didReceiveRemoteNotification:fetchCompletionHandler: is called.

Also from docs

didReceiveRemoteNotification: However, the system does not automatically launch your app if the user
has force-quit it. In that situation, the user must relaunch your app
or restart the device before the system attempts to launch your app
automatically again.

Is it possible to process a silent notification in iOS when your app is not running?

Essentially, the answer that I've been able to find so far (and @Sebrassi concurs with above) is that what I am asking for is not possible. The app does not get any processing time when a notification comes in, period, unless it is already running or the user launches it via the UI in one way or another.



Related Topics



Leave a reply



Submit