We want to make our own application using the Apple push notification. We want to make our own application using the Apple push notification. The problem is that we want to set up a system notification when users hover over it. We notice that Skype may display a βReplyβ button when you hover over a notification
.
Does anyone know how to create a notification like Skype? We would also like to make a couple of other modifications:
- Show another freeze notification.
- Show another hangup notification, preferably with a custom view, possibly including an image or webview?
Thanks.
Update:
I found that Skype does not use APNS to enter a new message (when Skype does not start, you will not see a notification when a new message arrives). A notification on the screen is a local notification. Thus, in my case using remote notification, I ignore the alert key of the remote notification payload and when the application receives the remote notification, it removes this notification from the Notification Center and clicks the new local notification. Here is the code:
func application(application: NSApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) { println(userInfo) // remove the remote one let deliveredNotifications = NSUserNotificationCenter.defaultUserNotificationCenter().deliveredNotifications if let lastRemoteNotif = deliveredNotifications.last as? NSUserNotification { NSUserNotificationCenter.defaultUserNotificationCenter().removeDeliveredNotification(lastRemoteNotif) } // push another local notification let localNotif = NSUserNotification() localNotif.title = "" localNotif.deliveryDate = NSDate() localNotif.title = "CeillingNinja" localNotif.subtitle = "This is local notification" localNotif.informativeText = "Some text" localNotif.contentImage = NSImage(named: "Status") NSUserNotificationCenter.defaultUserNotificationCenter().deliverNotification(localNotif) }
But when the application is not running, the user will see a blank notification in the Notification Center . I still stuck to this moment!
source share