Search code examples
objective-cvoipuilocalnotification

How to present the user with a choice in a local notification (in the lock screen)


When you get a skype call while your device is in standby, the screen lights up and shows a local notification in the lock screen. When you slide the notification you can see two buttons, one for accepting the call and one for declining the call. How did they manage that? I can't find anything about buttons in a local notification. I have almost the same behaviour in my voip app, but my users have to slide the notification to get in the app, and then accept or decline. I would like them to be able to accept or decline from the lock screen like skype.


Solution

  • It's called User Notification Categories. You can define one or multiple categories (e.g. a "call") and then add one or two buttons to it. It's fairly easy to implement so I won't show you any code. There's enough sample code at Apple's Developer Site if you know what to look for ("User Notification Categories").