How to realize communication between Cordova App and Native WatchKit Extension

百般思念 提交于 2019-12-13 15:23:00

问题


I would like to extend a ionic / Cordova IOS App by a WatchKit App (native written in swift). I am wondering which is the best way for communication between both. I checked the plugin: github.com/leecrossley/cordova-plugin-apple-watch which allows me to make basic communication, after changing to: MMWormholeTransitingTypeSessionMessage transition type on both sides. (Using Xcode9 and watchOS 4.0). Now I am asking myself if this MMWormhole is the best choice, as development stopped 2-3 years ago. Also for me is not clear if communication is possible if App is in background or even not started so far (how to check this or handle such situations?). My first tries showed that both Apps must be running and on iPhone side it's ok to be in background on WatchKit not.

How are you guys handling this?

Also saw the hint to use sockets for IPC, here I am not sure if this is possible with AppleWatch / WatchKit (have seen some answer doubting it...) Thanks for your help :)

来源:https://stackoverflow.com/questions/46529004/how-to-realize-communication-between-cordova-app-and-native-watchkit-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!