Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49186

Ionic app and Apple watch communication

$
0
0

@Kreepz wrote:

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!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>