Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to awaken an iOS app upon receiving a push notification even when it is killed

I need a way to receive a silent push notification, and then display a local one (so I can process data before displaying to user) Is there a way to do this? didReceiveNotification is only called when in the foreground. I believe the app is launched when in background upon receiving push. However, there does not seem to be a solution for when the app is killed.

EDIT I am aware of PushKit but my app is not a VOIP app, it is an IM app.

like image 597
Hamzah Malik Avatar asked Aug 29 '15 19:08

Hamzah Malik


People also ask

Will iOS awake my app when I receive silent push notification?

Silent notifications are not meant as a way to keep your app awake in the background beyond quick refresh operations, nor are they meant for high priority updates.

Are Apple push notifications guaranteed?

The system makes every attempt to deliver local and remote notifications in a timely manner, but delivery isn't guaranteed. The PushKit framework offers a more timely delivery mechanism for specific types of notifications, such as those VoIP and watchOS complications use. For more information, see PushKit.

What is silent push notification in iOS?

Silent push notifications are simply notifications that mobile app users receive without any pings, alerts, or interruptions to the user. They arrive on the mobile device and sit in the notification tray until read or dismissed.

Does an app need to be open for push notifications?

Push notifications are small, pop-up messages sent to a user's device by a mobile app that appear even when the app isn't open. These notifications are designed to grab attention and can convey reminders, updates, promotions, and more. Push notifications can consist of a title, a message, an image, and a URL.


1 Answers

You can use the UIApplicationDelegate method didReceiveRemoteNotification: to receive a 'silent' push when your app is in the foreground or background, but If your app is killed (force-quit from the switcher) then there is no way to receive the notification in your app. The notification payload (if any) will still be displayed to the user, giving them the opportunity to launch your app from the notification.

The documentation for this delegate method states:

In addition, if you enabled the remote notifications background mode, the system launches your app (or wakes it from the suspended state) and puts it in the background state when a remote notification arrives. 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

like image 113
Paulw11 Avatar answered Oct 21 '22 01:10

Paulw11