mkabatek
mkabatek

Reputation: 1276

Persistent local notification iOS

Is it possible to have a persistent local notification on iOS? I would like a notification when some aspect of an app is enabled, and for that notification to persist until the user disables the function in the app.

The solution I have thus far is to call the following every 60 seconds or so to refresh the notification:

[[UIApplication sharedApplication] cancelLocalNotification:localNotification];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification]; 

However the drawback of this is that the notification is not truly persistent, and also the screen comes on every time the notification fires. Is there a better solution out there?

In android this is simple:

builder.setOngoing(true)

Upvotes: 1

Views: 1328

Answers (1)

Cai
Cai

Reputation: 3659

No, it's not possible afaik. You also have no control over a sent local notification either.

If you want something to stay in the notification center, use Today widgets.

https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/ExtensibilityPG/NotificationCenter.html

Upvotes: 2

Related Questions