midori
midori

Reputation: 450

APNS: Receive silent Remote Notification if app was force quit

I am looking desperately for a way to receive silent remote notifications when the user has force quit his app.

I already experimented with this a while ago. The only way to do that, was to remove the content-available flag. But then it wasn't a silent notification anymore. The main use case was to download additional content to the remote notification and only then schedule a local notification in turn.

As the new UNNotification Framework was introduced they also introduced the new Notification Service Extension which provides an elegant way to download content corresponding to a remote notification.

But there is still no way to do the same with silent notifications when the app is force closed. Or did I miss something ?

PS: Maybe it is a duplicate, but other threads do not respect the Notification Service Extension.

Upvotes: 1

Views: 810

Answers (2)

midori
midori

Reputation: 450

Finally I found the answer in localisation also discussed here: Change language of alert in banner of Push Notification

I also use the new Notification Service Extension in combination to alter content before the notification is delivered.

Upvotes: 0

Konstantin  Kryzhanovsky
Konstantin Kryzhanovsky

Reputation: 1001

When app force closed. AppDelegate method:

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
}

will not called. But if your json payload contain aps you will see instant message, after you swipe (or click on notification) method will be called.

You can look google and find table of difference silent and normal state and their work in other Application State

Upvotes: 1

Related Questions