Ionic app and Apple watch communication


#1

Hi,

I’ve a Ionic application and I’m trying to use the cordova plugin apple watch but I’m stuck…
The 3 apps (ionic, extension, et watch app) got the same App Group.

In my watchkit extension InterfaceController.swift fields I’ve write:

let wormhole = MMWormhole(applicationGroupIdentifier: "group.com.mycompany.test", optionalDirectory: "test")

override func awakeWithContext(context: AnyObject?) {
    super.awakeWithContext(context)

    wormhole.listenForMessageWithIdentifier("mychannel", listener: { (messageObject) -> Void in
        if let message: AnyObject = messageObject {
            debugPrint(message)
        }
    })
}

And in my ionic app in app.js:

.run(function($ionicPlatform, $rootScope) {
    
    $ionicPlatform.ready(function() {

        ...

        applewatch.init(function (appGroupId) {

            applewatch.sendMessage("Hello first message", "mychannel");

        }, function(err){

        }, "group.com.mycompany.test");
    };
})

But when I launch the applications on simulator, I have no message in watchkitextension output…

If someone has a idea?

Thanks!


#2

This is very important, nobody can help me? :frowning: