Reputation: 135
I have an app which shows notification in iPhone. Now I am trying to show the same notification in WatchKit or in iWatch. So do I need to recopy all the functionalities I already did in ViewController and AppDelegate of iPhone app in Watchkit Extension or is there some common interface to notify the watch to show the notification, only UI I need to provide.
Upvotes: 1
Views: 417
Reputation: 336
iOS will decide to send notification to apple watch or to iPhone.
If your iPhone is active then notification will come to iPhone. If your iPhone is locked then notification will come to Apple Watch.
Did you have checked "Include Notification Scene" while adding target of watchkit app?
If yes then you can see notification class and WKUserNotificationInterface static interface in your storyboard.
You can also customize notification screen at dynamic interface.
If you want to handle notification then implement below method in screen which will display after click on notification in apple watch.
override func handleActionWithIdentifier(identifier: String?,
forRemoteNotification remoteNotification: [NSObject : AnyObject])
{
}
Please look at this link: https://developer.apple.com/library/watchos/documentation/General/Conceptual/WatchKitProgrammingGuide/CustomzingthePushNotificationInterface.html
Upvotes: 1