Using USB connection Easier, but supported to only devices with USB connection • Debugging over Bluetooth Need a bit work to do, but supported to many devices
• Go to Developer options and enable Debug over Bluetooth option • Connect paired phone • Open terminal, and run command (This must be done every time device reconnected) Note: the port can be any available port, doesn’t have to be 4444
is ready to debug (run adb devices) • Forward the AVD communication port by running command: (This command must be run every time handheld connected) • Start Android Wear app on handheld device • Select pair to new device and choose option connect to emulator
5.1 (API 22) or higher • Set targetSdkVersion to 22 or higher • Set minSdkVersion to 20 or higher (for backward-compatibility) • Add support wearable library dependency • Add uses-library com.google.android.wearable • Add WAKE_LOCK permission • Create an activity that extends WearableActivity • Call setAmbientEnabled() in the onCreate() method
ambient mode: • onEnterAmbient Called when an activity is entering ambient mode • onExitAmbient Called when an activity should exit ambient mode • onUpdateAmbient Called when the system is updating the display for ambient mode
wearable apps • Need to add google play service dependency to handheld and wearable apps • Application ID and version number for both apps (handheld and wear) must be same in order to work
automatic syncing between handheld and wearable • Messages API Provides API for sending message between handheld and wearable • Asset Used for sending binary blobs of data (attached to Data Items)
listening data layer event • DataListener Used for listening data layer event when activity in foreground • Channel API for transferring large data items
without automatic synchronization provided when using Asset with Data Items. Unlike Data API, Channel API doesn’t create copy in local device before synchronizing ◦ Handle large file sending better than Messages API ◦ Transfer data from remote node (streamed data from network or voice from microphone)
• Wearable app automatically pushed to Wear device when the paired handheld install the handheld app • Doesn’t work with debug key • Both app must have same application id, version number, and permission.