Is it possible to send SILENT LOCAL notification on iOS

My application wakes up from suspended mode in a quiet remote notification from the server exactly the way I want. This server sends a push notification with content : 1 ", which performs the task.

Now I want to do this without the help of the server, so I want to send silence to local notifications (from the application) at a time in the future (for example, after 15 minutes), but I can’t find a way to set “available content: 1”. Therefore, I get a local notification that does not wake up my application, as I can, with a remote notification.

I searched for information, and all I can find are examples of interactive notifications and how to set the title, body, warning and triggers (based on location, date, etc.). But nothing about setting the content-available property.

So, can I install content for local notifications?

+5
source share
3 answers

I think it's really impossible to wake up an application without user intervention in local notifications. Background fetching may be a possible solution for your case.

application.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum) 

This UIApplicationDelegate method is called when iOS decides that a background selection may occur:

 func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) 
+2
source
+1
source

The notification should be quiet unless you set all of these values:

 notification.alertBody = message; notification.alertAction = @"Show"; notification.category = @"ACTION"; notification.soundName = UILocalNotificationDefaultSoundName; 
-4
source

Source: https://habr.com/ru/post/1269551/


All Articles