Android Wear 設計理念
• Launched automatically (⾃自動啟動)
• Glanceable (可⼀一眼瞥⾒見)
• All about suggest and demand (推薦與需求)
• Zero or low interaction (盡可能減少點擊滑動步驟)
Debugging over Bluetooth
• ⼿手機設定 Debugging over bluetooth
• ⼿手錶設定 ADB Debug
& Debugging over bluetooth
• 執⾏行 ConnectDebugWear.sh
https://gist.github.com/j796160836/9b135a8de4c44846fd82
Slide 11
Slide 11 text
Debugging over Bluetooth
Slide 12
Slide 12 text
https://www.youtube.com/watch?v=q3a2fdTy_6A
Connect use USB?
Slide 13
Slide 13 text
Android Wear Emulator
& Phone Emulator
Slide 14
Slide 14 text
Android Wear Emulator
& Phone Emulator
• Choose x86 Emulator (faster)
• Install Google Search (2min)
com.google.android.googlequicksearchbox-3.6.16.1614640.x86.apk
• Install Android Wear (2min)
com.google.android.wearable.app
• Be patient
Slide 15
Slide 15 text
No content
Slide 16
Slide 16 text
WearHost for Genymotion
• Install ARM Translation Installer
Genymotion-ARM-Translation_v1.1.zip
• Install GApps
gapps-lp-20141109-signed.zip
gapps-kk-20140606-signed.zip
gapps-jb-20130813-signed.zip
• Install Google Search
com.google.android.googlequicksearchbox
• Install Android Wear
com.google.android.wearable.app
• Run Script: ConnectWearEmulator.sh
https://gist.github.com/j796160836/91e77ca819c11ed7bf01
Slide 17
Slide 17 text
Eclipse user?
Slide 18
Slide 18 text
Compile Wear in Eclipse
• Install Google Repository in SDK Manager
• Find wearable-1.1.0.aar in SDK
android-sdks/extras/google/m2repository/com/google/android/support/
wearable/1.0.0/wearable-1.1.0.aar
• Rename aar to zip and unzip it
• Import from existing code
• Check it Is Library
• Import google-play-service-lib
https://medium.com/@tangtungai/ef1b34126a5d
Slide 19
Slide 19 text
Compile Wear in Android Studio
• Edit Gradle
dependencies {
compile fileTree(dir:
compile
compile
}
[Wearable module]
Packaging Wearables using Ant
1. Export and Sign Wearable Apps APK
(eg: demowearapp.apk)
2. Add a meta-data tag in AndroidManifest.xml
3. Put your wearable binary in res/raw directory
(eg: res/raw/demowearapp.apk)
4. Write reference descriptions xml
(eg: res/xml/wearable_app_desc.xml)
5. Turn off Asset Compression
https://developer.android.com/training/wearables/apps/packaging.html#PackageManually
https://medium.com/@tangtungai/ef1b34126a5d
Slide 22
Slide 22 text
Packaging Wearables in Eclipse
1. Export and Sign Wearable Apps APK
(eg: demowearapp.apk)
#!/bin/bash
cd ../wearable-1.1.0
android update lib-project --path .
ant clean release
cd ../DemoWearApp
android update project --path .
ant clean release
key.store=
key.store.password=
key.alias=
key.alias.password=
config.logging=true
ant.properties
Generate build.xml
[Wearable project]
Slide 23
Slide 23 text
Packaging Wearables in Eclipse
2. Add a meta-data tag in AndroidManifest.xml
[Smartphone project]
Slide 24
Slide 24 text
Packaging Wearables in Eclipse
3. Put your wearable binary in res/raw directory
(eg: res/raw/demowearapp.apk)
4. Write reference descriptions xml
(eg: res/xml/wearable_app_desc.xml)
1
1.0
demowearapp
[Smartphone project]
Slide 25
Slide 25 text
Packaging Wearables in Eclipse
5. Turn off Asset Compression
http://stackoverflow.com/questions/7937368/how-to-pass-arguments-to-aapt-when-building-android-apk
From /tools/ant/build.xml, search -package-resources
Add this
[Smartphone project]
Slide 26
Slide 26 text
[Smartphone module]
dependencies {
compile fileTree(dir:
compile
compile
wearApp project(
}
Packaging Wearables in Android Studio
• Edit Gradle
Android Wear
Google Play Services
Google Play Services
Android Device
Controller
Model
View
Mini
Controller
View
Model
Controller
View
Model
App structure
Android Wear
WatchKit
iOS App