Can I use PushKit to do regular push with out using VoIP? Will it allow killed app to be launched in background if user does not act on notification?
Asked Answered
D

4

22

In the PushKit it is mentioned we can use regular push or VoIP push. But I did not find any documentation for what PKPushType to use for regular push. Did anybody try the regular push using the PushKit? If I don't use VoIP is it possible for a killed app to be launched in the background if it receives push notification? Meaning if app is killed and a notification comes and user does not act on it, can the app be launched by iOS in the background if I use PushKit?

Dichroic answered 17/4, 2015 at 15:26 Comment(2)
Did you find out if it launches a killed app and what type you should use?Tonnage
possibly, no you can't use pushkit to do regular push #33650169Tillich
S
9

Since iOS 13.0, this is NOT allowed anymore. Apple will kill the app if failing to present CallKit before the didReceiveIncomingPush(withPayload:) is finished.

An Apple Employee answered a similar question in this thread and said the following:

On iOS 13.0 and later, incoming Voice over IP calls must be reported when they are received and before the didReceiceIncomingPush() method finishes execution, using the CallKit framework, or the system will terminate your app.

Repeatedly failing to report calls may prevent your app from receiving any more incoming call notifications.

Basically, you can no longer use VoIP pushes for non VoIP messaging, and will need to use regular push notifications for those.

This was announced during the WWDC session "Advances in App Background Execution" https://developer.apple.com/videos/play/wwdc2019/707/

So sadly not anymore. We will have to use the normal UINotification framework for "standard" push messages.

Strophanthus answered 30/9, 2019 at 6:53 Comment(2)
That means we going back to normal APNS which does not help if the app was totally closed by the user? no way to execute a block of code when the app gets notifications while terminated by the user ?Underling
If you just want to have some execution time (~ 30 seconds) when a notification is received, then you can implement a UNNotificationServiceExtension. But please note that the notification will be displayed to the user after the extension calls a completion handler or when it times out.Wakeup
C
2

I'm not sure what you mean by using "regular push" with PushKit, but you can use it to dispatch a notification regularly, although I think it will always execute your code, like a silent remote notification (maybe that's what you are wondering).

If you use PushKit, it does indeed launches an app when the notification is received, even if it was force-killed by the user. See this answer. I would just add that you probably need the Voice Over IP capability to achieve that effect.

Captivity answered 30/6, 2015 at 15:42 Comment(0)
R
2

Another Important point need to be noted from documentation:

Unlike user notifications, which are supported by the UserNotifications framework, PushKit notifications are never presented to the user—they don't present badges, alerts, or sounds.

Raul answered 27/7, 2018 at 7:23 Comment(0)
D
0

Edit: This answer is not valid anymore.


Yes you can, check Apple Document

The PushKit framework provides the classes for your iOS apps to receive pushes from remote servers. Pushes can be of one of two types: standard and VoIP. Standard pushes can deliver notifications just as in previous versions of iOS.

Dreamland answered 1/1, 2017 at 12:4 Comment(2)
this sentence is no longer in this document. so I don't know if it applies here anymore...Lakenyalaker
Thanks @Lakenyalaker for mentioning this!Dreamland

© 2022 - 2024 — McMap. All rights reserved.