React Native-Android Wear Communication Demo
Showcase of an established two-way communication between a React Native app and an Android Wear app using the MessageAPI.
Running it from Android Studio
Clone the repository
git clone https://github.com/bevkoski/react-native-android-wear-demo.git
cd react-native-android-wear-demo
Install dependencies
yarn
or npm install
Start the packager
react-native start
Open the project in Android Studio
- Start Android Studio
- Choose "Open an existing Android Studio project"
- Select the
/react-native-android-wear-demo/android
folder
Run the mobile app
- Connect your Android phone via USB
- Select the
app
module as a run configuration - Run the
app
module - Select your phone from the available connected devices
If you get one of the following error messages:
Could not connect to development server.
Could not get BatchedBridge, make sure your bundle is packaged properly.
Try executing adb reverse tcp:8081 tcp:8081
from the command line and reloading the app.
Run the watch app
- Connect your Android watch via USB
- Select the
wear
module as a run configuration - Run the
wear
module - Select your watch from the available connected devices
How it works
Check out this Medium article.
Thanks
Special thanks to @toteto for the implementation of the watch app and the extensive contribution to the native parts of the mobile app.