简体   繁体   中英

React-Native communication with Android Wear

I currently have a react-native app with an android wear module. The RN app is able to communicate with the wear app through the use of Native Modules. The wear app is able to communicate with the RN app by sending events to the javascript using RCTDeviceEventEmitter. The communication from wear to RN works, as long as the RN app is running, either on screen or in background.

The Native code runs and logs all the way up until it gets to the ReactContextBaseJavaModule, so the code, even on the native mobile side, is running, just not the React classes. Is there a way for me to communicate with the RN javascript, if the app is closed?

Check out the below repo. It has explained how it works too:

https://github.com/bevkoski/react-native-android-wear-demo/tree/capability-api

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM