priyanka
priyanka

Reputation: 11

Push Notification issue on Apple Watch OS2

I'm developing a push notification app for iOS 9beta - watch OS 2 beta with xcode 7 beta 6... I've done all the settings mentioned in apple documents but I receive push notifications only in my iPhone app and not on watch.. Even when my iPhone app is not running in foreground, I still receive a beep sound in iPhone but nothing on watch.. This is the payload structure which is pushed by the server :

{
    "aps": {
        "alert": {
            "body": “Notification Body",
            "title": “Notification Title"
        },
        "category": "MessageCategory",
        "badge" : 1,
        "sound" : "default"
    },
    "WatchKit Simulator Actions": [
                                   {
                                   "title": "View",
                                   "identifier": "ViewAction"
                                   }
                                   ],
    "callVolume": {
        "BU 1": 25,
        "BU 2": 30,
        "BU 3": 45,
        "BU 4": 50,
        "BU 5": 60
    }
}

I can run "Notification - WatchApp” target and see the dynamic interface loading. But when the push notification is received, override func didReceiveRemoteNotification(remoteNotification: [NSObject : AnyObject], withCompletion completionHandler: ((WKUserNotificationInterfaceType) -> Void)) is not triggered.

Am I missing anything ? Thanks in advance.

Upvotes: 1

Views: 391

Answers (1)

priyanka
priyanka

Reputation: 11

I'm found an answer for my question.This is the payload structure I'm using.

{ "aps": {

    "alert": {
       "title": "Some message title",

        "body": "Some message body"
    },

    "category": "MyCategory",

    "badge": 1,

    "sound": "default"

},

"callVolume": {

    "BU1": 25,

    "BU2": 45,

    "BU3": 100,

    "BU4": 35,

    "BU5": 60
}

}

The button titles are displayed based on the title we register for UIMutableUserNotificationAction in UIUserNotificationSettings.

Upvotes: 0

Related Questions