Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to send SILENT LOCAL notification on iOS

My app wakes up from suspended mode on silent remote notification from a server, exactly as I want. This server sends a push notification with "content-available:1", which does the job.

Now I want to do this without the help of a server and so I want to send silent local notifications (from the app) at a time in the future (like after 15 min.), but can't find a way to set "content-available:1". So I end up getting local notification that doesn't wake up my app, as I can with remote notification.

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

So, is possible to set content-available for local notifications?

like image 264
AndaluZ Avatar asked Jul 06 '17 09:07

AndaluZ


People also ask

What is silent notification in IOS?

Silent notifications is a feature allowing to send notifications without disturbing the user. Notifications are not shown in the notification center or notification bar. Callback methods are executed even when the application is running in the background.

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

Yes. It will. When you click on that. Yeah its ok but being push notification is silent,you are not able to view any alert and cant click.


2 Answers

It's just not possible without user intervention. There is no Android's AlarmManager kind of solution to wake up the app from suspended mode in iOS. In iOS there's no way to periodically wake up app from suspended mode, except from remote push notification (if an extern application sends a push notification periodically).

like image 68
AndaluZ Avatar answered Oct 13 '22 01:10

AndaluZ


I think it is not really possible to wake up app without user intervention on local notifications. Background fetch could be the possible solution for your case.

application.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum)

This UIApplicationDelegate method gets called when iOS decides a background fetch can happen:

func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void)
like image 27
Ellen Avatar answered Oct 13 '22 00:10

Ellen