Smartwatch heart rate sensor data retrieval and transfer to mobile.
Create and run a virtual smartwach device
- On your handheld, install the Android Wear app from Google Play.
- Connect the handheld to your machine through USB.
- Forward the AVD's communication port to the connected handheld device (you must do this every time the handheld is connected):
adb -d forward tcp:5601 tcp:5601
- Start the Android Wear app on your handheld device and connect to the emulator.
- Tap the menu on the top right corner of the Android Wear app and select Demo Cards.
- The cards you select appear as notifications on the home screen of the emulator.
- Go to Settings > About.
- Tap Build number seven times.
- Swipe right to return to the Settings menu.
- Go to Developer options at the bottom of the screen.
- Tap ADB Debugging to enable adb.
- Connect the wearable to your machine through USB, so you can install apps directly to it as you develop. A message appears on both the wearable and the Android Wear app prompting you to allow debugging.
- Note: If you can not connect your wearable to your machine via USB, you can try connecting over Bluetooth. - On the Android Wear app, check Always allow from this computer and tap OK.
- Enable USB debugging on the handheld: - Open the Settings app and scroll to the bottom. - If it doesn't have a Developer Options setting, tap About Phone (or About Tablet), scroll to the bottom, and tap the build number 7 times. - Go back and tap Developer Options. - Enable USB debugging.
- Enable Bluetooth debugging on the wearable: - Tap the home screen twice to bring up the Wear menu. - Scroll to the bottom and tap Settings. - Scroll to the bottom. If there's no Developer Options item, tap About, and then tap the build number 7 times. - Tap the Developer Options item. - Enable Debug over Bluetooth.
- Set Up a Debugging Session
- On the handheld, open the Android Wear companion app.
- Tap the menu on the top right and select Settings.
- Enable Debugging over Bluetooth. You should see a tiny status summary appear under the option:
Host: disconnected Target: connected
- Connect the handheld to your machine over USB and run:
```
adb forward tcp:4444 localabstract:/adb-hub
adb connect localhost:4444
```
+ **Note:** You can use any available port that you have access to.
- In the Android Wear companion app, you should see the status change to:
```
Host: connected
Target: connected
```