- Broschiertes Buch
- Merkliste
- Auf die Merkliste
- Bewerten Bewerten
- Teilen
- Produkt teilen
- Produkterinnerung
- Produkterinnerung
Software Development/Mobile/Android/Wearable/Fitness
Build "Wearable" Applications on the Android Wear and Google Fit Platforms
This book covers wearable computing and wearable application development particularly for Android Wear (smartwatches) and Google Fit (fitness sensors). It provides relevant history, background and core concepts of wearable computing and ubiquitous computing, as a foundation for designing/developing applications for the Android Wear and Google Fit platforms. This book is intended for Android wearable enthusiasts, technologists and software developers.
Gain…mehr
Andere Kunden interessierten sich auch für
- Alain AbranSoftware Metrics104,99 €
- Shoshana LoebThe Fabric of Mobile Services131,99 €
- Eddie C. L. ChanIntroduction to Wireless Localization141,99 €
- Paul GoldingNext Generation Wireless Applications149,99 €
- James McDonaldManaging the Development of Software-Intensive Systems122,99 €
- James J. NutaroBuilding Software for Simulation159,99 €
- Jan JantzenFoundations of Fuzzy Control134,99 €
-
-
-
Software Development/Mobile/Android/Wearable/Fitness
Build "Wearable" Applications on the Android Wear and Google Fit Platforms
This book covers wearable computing and wearable application development particularly for Android Wear (smartwatches) and Google Fit (fitness sensors). It provides relevant history, background and core concepts of wearable computing and ubiquitous computing, as a foundation for designing/developing applications for the Android Wear and Google Fit platforms. This book is intended for Android wearable enthusiasts, technologists and software developers.
Gain insight into "wearables" in the modern consumer ecosystem of a multitude of devices, ubiquitous computing, cloud computing and intelligent personal assistants
Learn the Android Wear and Google Fit APIs and jump-start hands-on development including: setting up an Android development environment suitable for Android Wear and Google Fit , setting up smartwatch and fitness devices for development and debugging , writing applications that install and execute on Android Wear (smartwatch) devices , and applications that run on your handheld Android devices and find and connect to fitness sensors and access fitness data, and more
Catch up with the new Android 5.0 "Lollipop", Android Studio and the gradle based build system
Learn how to write applications for smart watches and fitness sensors on the Android/Google ecosystem.
"Sanjay's tome provides a comprehensive and timely treatment of the essential points of current Wearable technology and Android Wearable development techniques. The easygoing and comprehensive examples make this book a joy to discover and a delight to peruse. Highly recommended!"
- Rudi Cilibrasi, Computer Scientist
"The text provides a rich and immersive overview of the field of Wearable computing that is solidified by the impressive set of examples. I was simultaneously entertained as well as educated, and would highly recommend this book to anyone that is looking to get started with Wearables."
- Nathan Blair, Software Engineer & Entrepreneur
Sanjay M. Mishra began programming in C on various flavors of Unix in the early 1990s. Over the years he has developed diverse software systems spanning web applications and services, messaging, VoIP, NoSQL databases, as well as mobile and embedded platforms. He has worked for companies such as Intertrust, Eyecon Technologies, CallSource, nVoc (formerly Sandcherry, Inc.) and the Starz Entertainment group.
Hinweis: Dieser Artikel kann nur an eine deutsche Lieferadresse ausgeliefert werden.
Build "Wearable" Applications on the Android Wear and Google Fit Platforms
This book covers wearable computing and wearable application development particularly for Android Wear (smartwatches) and Google Fit (fitness sensors). It provides relevant history, background and core concepts of wearable computing and ubiquitous computing, as a foundation for designing/developing applications for the Android Wear and Google Fit platforms. This book is intended for Android wearable enthusiasts, technologists and software developers.
Gain insight into "wearables" in the modern consumer ecosystem of a multitude of devices, ubiquitous computing, cloud computing and intelligent personal assistants
Learn the Android Wear and Google Fit APIs and jump-start hands-on development including: setting up an Android development environment suitable for Android Wear and Google Fit , setting up smartwatch and fitness devices for development and debugging , writing applications that install and execute on Android Wear (smartwatch) devices , and applications that run on your handheld Android devices and find and connect to fitness sensors and access fitness data, and more
Catch up with the new Android 5.0 "Lollipop", Android Studio and the gradle based build system
Learn how to write applications for smart watches and fitness sensors on the Android/Google ecosystem.
"Sanjay's tome provides a comprehensive and timely treatment of the essential points of current Wearable technology and Android Wearable development techniques. The easygoing and comprehensive examples make this book a joy to discover and a delight to peruse. Highly recommended!"
- Rudi Cilibrasi, Computer Scientist
"The text provides a rich and immersive overview of the field of Wearable computing that is solidified by the impressive set of examples. I was simultaneously entertained as well as educated, and would highly recommend this book to anyone that is looking to get started with Wearables."
- Nathan Blair, Software Engineer & Entrepreneur
Sanjay M. Mishra began programming in C on various flavors of Unix in the early 1990s. Over the years he has developed diverse software systems spanning web applications and services, messaging, VoIP, NoSQL databases, as well as mobile and embedded platforms. He has worked for companies such as Intertrust, Eyecon Technologies, CallSource, nVoc (formerly Sandcherry, Inc.) and the Starz Entertainment group.
Hinweis: Dieser Artikel kann nur an eine deutsche Lieferadresse ausgeliefert werden.
Produktdetails
- Produktdetails
- Verlag: Wiley & Sons
- 1. Auflage
- Seitenzahl: 280
- Erscheinungstermin: 15. September 2015
- Englisch
- Abmessung: 233mm x 154mm x 20mm
- Gewicht: 426g
- ISBN-13: 9781119051107
- ISBN-10: 111905110X
- Artikelnr.: 42055013
- Herstellerkennzeichnung
- Libri GmbH
- Europaallee 1
- 36244 Bad Hersfeld
- 06621 890
- Verlag: Wiley & Sons
- 1. Auflage
- Seitenzahl: 280
- Erscheinungstermin: 15. September 2015
- Englisch
- Abmessung: 233mm x 154mm x 20mm
- Gewicht: 426g
- ISBN-13: 9781119051107
- ISBN-10: 111905110X
- Artikelnr.: 42055013
- Herstellerkennzeichnung
- Libri GmbH
- Europaallee 1
- 36244 Bad Hersfeld
- 06621 890
Sanjay M. Mishra began programming in C on various flavors of Unix in the early 1990s. Over the years he has developed diverse software systems spanning web applications and services, messaging, VoIP, NoSQL databases, as well as mobile and embedded platforms. He has worked for companies such as Intertrust, Eyecon Technologies, CallSource, nVoc (formerly Sandcherry, Inc.) and the Starz Entertainment group.
About the Author xv
About This Book xvii
Acknowledgments xxiii
Part I Wearable Computing: Introduction and Background 1
1 Wearables: Introduction 3
1.1 Wearable Computing 3
1.2 Wearable Computers and Technology 3
1.3 "Wearables" 4
1.4 The word: "Wearables" 4
1.5 Wearables and Smartphones 5
1.6 Wearable Light, Glanceable Interactions 5
1.7 Smartphone Dependency, Inconveniences 5
1.8 Wearable Interaction 6
1.9 User's Real-world Context 6
1.10 Variety of Wearable Devices 6
1.10.1 Smart Watches 6
1.10.2 Fitness Sensors 7
1.10.3 Smart Jewelry 7
1.11 Android Wear and Google Fit 7
1.11.1 Device / Hardware Purchases 7
References and Further Reading 8
2 Wearable Computing Background and Theory 9
2.1 Wearable Computing History 9
2.1.1 Wearable Computing Pioneers 10
2.1.2 Academic Research at Various Universities 11
2.2 Internet of Things (IoT) and Wearables 11
2.2.1 Machine to Machine (M2M) 13
2.3 Wearables' Mass Market Enablers 13
2.3.1 "ARM-ed" revolution 14
2.3.1.1 ARM alternatives 14
2.3.2 System on Chip (SoC) 14
2.3.3 Human Dependence on Computing 15
2.3.4 Smartphone extensions 15
2.3.5 Sensors 15
2.3.5.1 Micro-Electro-Mechanical Systems (MEMS) Sensors 16
2.4 Human-Computer Interface and Human-Computer Relationship 16
2.4.1 Human-Computer Interface: over the years 16
2.4.2 Human Computer Interaction (HCI): Demand and Suggest 17
2.4.2.1 Demand Paradigm 17
2.4.2.2 Suggest Paradigm 18
2.4.2.3 Demand or Suggest? 18
2.4.2.4 Demand and Suggest: A Healthy Balance 18
2.4.3 Evolution of the Human-Computer Relationship 18
2.5 A Multi-Device World 19
2.5.1 Spatial Scope of Computing: Devices near and Devices far 19
2.5.2 Body Area Network (BAN) 19
2.5.3 Personal Area Network (PAN) 20
2.5.4 Home Area Network (HAN) 21
2.5.5 Automobile Network 21
2.5.5.1 Controller Area Network (CAN) 21
2.5.6 Near-Me Area Network (NAN) 21
2.5.7 Campus Area Network 22
2.5.8 Metro Area Network 22
2.5.9 Wide Area Network 22
2.5.10 Internet 22
2.5.11 Interplanetary Network 23
2.6 Ubiquitous Computing 23
2.7 Collective, Synergistic Computing Value 23
2.7.1 Importance of the User Centricity and the User Context 23
2.7.2 Distributed Intelligent Personal Assistant 24
2.8 Bright and Cloudy: Cloud-based Intelligent Personal Agent 24
2.8.1 Google / Cloud-Based Intelligent Personal Agent 24
2.9 Leveraging Computer Vision 25
2.9.1 Enhanced Computer Vision / Subtle Change Amplification 25
2.10 IoT and Wearables: Unnatural and over the top? 26
2.10.1 Human History of Tool Use and Computation 27
2.10.2 Communication Networks in Nature 27
2.10.3 Consumption of Power: by computational systems, biological and
artificial 28
2.11 Security and Privacy Issues 28
2.11.1 Use Awareness and complete end-to-end Transparency 29
2.11.2 User Control and Choice 30
2.11.3 User Access to Collected Data and Erasure capability 30
2.11.4 Device side, transit, and cloud side protection: Data Anonymization
30
2.11.5 Practical Considerations: User Centricity 30
2.11.5.1 OpenID 31
2.12 Miscellaneous 31
2.12.1 PhoneBloks: Waste Reduction 31
2.12.1.1 Project "Ara" 31
2.12.2 Google Cardboard: inexpensive Virtual Reality 32
References and Further Reading 32
Part II Foundation Android 35
3 Android Fundamentals / Hello Lollipop 37
3.1 Android: Introduction 37
3.2 Linux: "*nix" or Unix-like OS 38
3.2.1 Unix 38
3.2.2 Open Source 39
3.2.3 GNU / Free Software Foundation 39
3.2.3.1 Free as in Freedom: GNU Public License 40
3.2.4 Apache Software Foundation: Apache Software License 41
3.3 Linux: yesterday and today 41
3.4 Unix System Architecture 41
3.4.1 Unix Processes 42
3.4.1.1 Linux Processes 42
3.4.1.2 Android Processes 42
3.4.1.3 Process Tree 42
3.4.1.4 Unix Interprocess Communication (IPC) 43
3.4.1.5 Remote Procedure Calls (RPC) 44
3.4.2 Unix Kernel 44
3.4.2.1 Linux Kernel 44
3.5 Java 44
3.5.1 Java Origins 45
3.5.2 Java Platform: Language, JVM 45
3.5.3 Java memory: Heap, Stack, and native 45
3.5.4 Security Policy: Permissions 46
3.6 Apache Harmony 46
3.7 Android OS and platform 47
3.7.1 Android Kernel 47
3.7.2 Android Open Source Project (AOSP) 50
3.7.2.1 Android Framework 50
3.7.3 Android Development 50
3.7.3.1 Android SDK 51
3.7.3.2 Android NDK 51
3.7.4 Android Runtime Environment 51
3.7.4.1 Dalvik Virtual Machine 52
3.7.4.2 ART (Android Runtime) 52
3.7.4.3 Zygote 52
3.7.4.4 System Server: Android System Services 53
3.7.5 Android Interface Definition Language (AIDL) 53
3.8 Setting up your Android Development Environment 54
3.8.1 Installing Java SDK version 7 (JDK 1.7) from Sun Microsystems /
Oracle 54
3.8.2 Installing Android SDK from Google 56
3.8.3 Installing Build Tools (gradle and ant) 63
3.8.4 Setting up environment variables (Java, Android SDK, gradle and ant)
63
3.8.5 Android (Lollipop) Development Device setup 64
3.8.5.1 Creating a new Android project (classic / ant) 65
3.8.5.2 Creating a new Android project (new / gradle) 71
3.8.6 Installing Android Studio "IDE" 72
3.8.7 Android Studio: Hello World App 76
3.8.8 Configuring Android Studio 81
3.9 Android "Classic" project tree and build system 82
3.10 Android "New" Build System 82
3.11 Managing Java Installations 83
3.11.1 Avoid sudo apt-get / rpm style installation 83
3.11.2 Maintain discrete Java JDK versions 83
3.11.3 Set JAVA_HOME in your .profile 84
3.11.4 Project-wise JAVA_HOME 84
3.11.5 IDE independent build 84
3.12 Managing Android SDK installation and updates 84
3.12.1 Update your Android SDK often 84
3.12.2 Target your App to the latest SDK / API level 85
3.12.3 Be sure to specify a minimum SDK / API level for your App 85
3.13 Code Samples: Android Lollipop 85
References and Further Reading 85
4 Android SDK 87
4.1 Software Components, in general 87
4.2 Android Application Development Model 88
4.2.1 DEX file format 88
4.2.2 APK file 88
4.2.3 Android Project Build Process 90
4.2.4 APK installation and execution 90
4.2.4.1 Application main thread / UI thread 91
4.3 Android SDK API 91
4.3.1 Android Application Manifest (AndroidManifest.xml) 92
4.3.2 Android API package Overview 92
4.4 Android's Four Fundamental Components 93
4.4.1 Android Project Artifacts 94
4.5 Activity 94
4.5.1 Activity life cycle 96
4.6 Service 98
4.7 BroadcastReceiver 100
4.8 ContentProvider 100
4.9 Intent 101
4.9.1 Intent Action and Data 104
4.9.1.1 Intent Extras 104
4.9.1.2 Intent Flags 104
4.9.2 Explicit Intents 105
4.9.3 Implicit Intents 105
4.9.4 Intent Filter 105
4.9.5 Intent Resolution 106
4.9.6 Intent Use Cases 106
4.9.6.1 Starting Activities 106
4.9.6.2 Starting Services 106
4.9.6.3 Delivering Broadcasts 106
4.10 android package, sub-packages 107
4.11 dalvik package, sub-packages 107
4.12 java and javax package, sub-packages 108
4.13 org package, sub-packages 108
4.14 Sample code in this book 109
References and Further Reading 109
5 Android Device Discovery and Communication 111
5.1 Android Interconnectivity 111
5.2 Advertisement and Discovery 112
5.3 Bluetooth 112
5.3.1 Bluetooth Low Energy (LE) 112
5.3.2 Bluetooth Generic Attribute Profiles (GATT) 112
5.3.3 Android support for Bluetooth LE 113
5.4 Wi-Fi Peer-to-Peer (Wi-Fi Direct) 113
5.4.1 Android Wi-Fi Direct / P2P API 114
5.5 Zero Configuration Networking (zeroconf) 114
5.5.1 Android Network Service Discovery (NSD) 115
5.6 Near Field Communication (NFC) 115
5.7 Universal Serial Bus (USB) 116
5.7.1 USB On-The-Go (USB OTG) 116
References and Further Reading 116
Part III Android Wear Platform and SDK 119
6 Android Wear Platform 121
6.1 Android Wear 121
6.2 Android Wear Platform: Android Wear OS,
Wear Devices, and Wear API 122
6.2.1 Android Wear OS 122
6.2.2 Android Wear Devices 122
6.2.3 Android Wear API and Wear Apps 123
6.3 Android Notifications and Android Wear 123
6.3.1 Android 5.0 (Lollipop) Notifications 124
6.4 Notification Settings and Control 126
6.4.1 Sound and Notification and Priority Notification 126
6.4.2 Notification Configuration and Control 129
6.4.3 Locked Screen and Notifications 131
6.4.3.1 Notification Access 134
6.4.4 Interruptions 135
6.5 App Notification Strategy 136
6.6 Google Now and Android Wear 137
6.7 Android Wear Devices: Getting Started 138
6.7.1 Android SDK Wear Platform updates 138
6.7.2 Procuring an Android Wear device 139
6.7.2.1 Using Android Emulator with Wear AVD 140
6.7.3 Pairing and Enabling Developer Mode 145
6.7.3.1 Unboxing your Wear device 145
6.7.3.2 Pairing your Handheld device with your Wear device 145
6.7.3.3 Enabling Developer Mode and Debugging Settings on your Wear device
150
6.7.3.4 Enabling Wear ADB Debugging and Debug over Bluetooth 153
6.8 Wear Debugging and Android SDK 155
6.8.1 Wear Debugging via USB 155
6.8.2 Wear Debugging via Bluetooth 158
6.9 Peeking under the hood of your Wear Device 161
6.10 Engaging your Android Wear device via Notifications 163
6.10.1 Engaging Android Wear via Notification Sync 163
6.10.2 Wear Extended Notifications 163
6.11 Android Wear Targeted Apps 165
6.12 Hello Wear World: Writing our first Wear App 165
References and Further Reading 168
7 Android Wear API 169
7.1 Google Services and Google Play Services 169
7.1.1 GoogleApiClient class 171
7.2 Android Wear Network 173
7.3 Android Wear API, in depth 173
7.3.1 Wear API: wearable package 174
7.3.1.1 Node interface 174
7.3.1.2 WearableListenerService 174
7.3.1.3 DataEvent 175
7.3.1.4 MessageEvent 175
7.3.2 Wearable class 176
7.3.3 NodeApi 177
7.3.4 DataApi 177
7.4 DataItem, DataMapItem, and DataMap 178
7.4.1 DataItem 178
7.4.2 DataMapItem 180
7.4.3 DataMap 180
7.5 PutDataRequest and PutDataMapRequest 180
7.5.1 PutDataRequest 180
7.5.2 PutDataMapRequest 180
7.6 Asset and DataItemAsset 182
7.6.1 Asset class 182
7.6.2 DataItemAsset interface 182
7.7 MessageApi 183
7.8 Wearable UI Library 184
7.9 Wear Interaction Design 185
7.10 Accessing Sensors 186
7.11 Production Wear Apps 187
References and Further Reading 187
Part IV Google Fit Platform and SDK 189
8 Google Fit Platform 191
8.1 Google Fit Platform Overview 191
8.2 Google Fit Core Concepts 192
8.3 Fit Data Types 192
8.4 Fit Data Store (Storage) 193
8.5 Sensors 193
8.6 Permissions, User Consent 194
8.6.1 Permission Groups, Fitness Scopes 194
8.6.1.1 Activity Scope 194
8.6.1.2 Body Scope 194
8.6.1.3 Location Scope 194
8.7 Google Fit: Developer Responsibilities 195
8.7.1 Developer Terms and Conditions 195
8.7.2 Developer Branding Guidelines 195
8.8 Procuring Sensor Peripherals 195
8.9 Hello Fit: hands-on example 195
8.9.1 Google Play Services library project, dependency 196
8.9.2 Using the SHA1 fingerprint of the keystore 198
8.9.3 Google Developer's Console Activating Fit API 200
8.9.4 Creating the Android App 202
8.10 Google's Fit App 211
8.11 Google Settings App 211
References and Further Reading 212
9 Google Fit API 213
9.1 Google Fit API 213
9.2 Google fit main package (com.google.android.gms.fitness) 213
9.2.1 Fitness class 214
9.2.2 FitnessActivities class 216
9.2.3 FitnessStatusCodes class 216
9.2.4 BleApi interface 217
9.2.5 SensorsApi 218
9.2.6 RecordingApi 219
9.2.7 SessionsApi 220
9.2.8 HistoryApi 221
9.2.9 ConfigApi 222
9.3 data sub-package 223
9.3.1 Device 223
9.3.2 BleDevice 223
9.3.3 DataSource 224
9.3.4 DataType 225
9.3.5 DataPoint 225
9.3.6 Field 227
9.3.7 Value 228
9.3.8 Subscription 228
9.3.9 DataSet 229
9.3.10 Session 230
9.3.11 Bucket 230
9.4 request sub-package 231
9.4.1 StartBleScanRequest 232
9.4.2 BleScanCallback 233
9.4.3 SensorRequest 233
9.4.4 DataSourcesRequest 233
9.4.5 OnDataPointListener 234
9.4.6 DataReadRequest 234
9.4.7 DataDeleteRequest 235
9.4.8 SessionInsertRequest 236
9.4.9 SessionReadRequest 236
9.4.10 DataTypeCreateRequest 236
9.5 result sub-package 236
9.5.1 BleDevicesResult 237
9.5.2 DataSourcesResult 238
9.5.3 ListSubscriptionsResult 238
9.5.4 DataReadResult 238
9.5.5 SessionReadResult 239
9.5.6 SessionStopResult 239
9.5.7 DataTypeResult 239
9.6 service sub-package 240
9.6.1 FitnessSensorService 242
9.6.2 FitnessSensorServiceRequest 242
9.6.3 SensorEventDispatcher interface 243
References and Further Reading 243
Part V Real-World Applications 245
10 Real-World Applications 247
10.1 Real-World Applications 247
10.2 Handheld Application Extension 247
10.3 Home Automation 247
10.3.1 Home Entertainment 248
10.3.2 Gaming 248
10.4 Wearables at the Workplace 248
10.5 Fitness, Health, and Medical 248
10.5.1 Predictive and Proactive Consumer Health 249
10.5.2 Wearables for Medical Professionals 249
10.5.3 Wearables and Remote Medical Diagnostics 249
10.6 Industrial Manufacturing 250
10.7 Civic, Government, and Democracy 250
References and Further Reading 250
Index 251
About This Book xvii
Acknowledgments xxiii
Part I Wearable Computing: Introduction and Background 1
1 Wearables: Introduction 3
1.1 Wearable Computing 3
1.2 Wearable Computers and Technology 3
1.3 "Wearables" 4
1.4 The word: "Wearables" 4
1.5 Wearables and Smartphones 5
1.6 Wearable Light, Glanceable Interactions 5
1.7 Smartphone Dependency, Inconveniences 5
1.8 Wearable Interaction 6
1.9 User's Real-world Context 6
1.10 Variety of Wearable Devices 6
1.10.1 Smart Watches 6
1.10.2 Fitness Sensors 7
1.10.3 Smart Jewelry 7
1.11 Android Wear and Google Fit 7
1.11.1 Device / Hardware Purchases 7
References and Further Reading 8
2 Wearable Computing Background and Theory 9
2.1 Wearable Computing History 9
2.1.1 Wearable Computing Pioneers 10
2.1.2 Academic Research at Various Universities 11
2.2 Internet of Things (IoT) and Wearables 11
2.2.1 Machine to Machine (M2M) 13
2.3 Wearables' Mass Market Enablers 13
2.3.1 "ARM-ed" revolution 14
2.3.1.1 ARM alternatives 14
2.3.2 System on Chip (SoC) 14
2.3.3 Human Dependence on Computing 15
2.3.4 Smartphone extensions 15
2.3.5 Sensors 15
2.3.5.1 Micro-Electro-Mechanical Systems (MEMS) Sensors 16
2.4 Human-Computer Interface and Human-Computer Relationship 16
2.4.1 Human-Computer Interface: over the years 16
2.4.2 Human Computer Interaction (HCI): Demand and Suggest 17
2.4.2.1 Demand Paradigm 17
2.4.2.2 Suggest Paradigm 18
2.4.2.3 Demand or Suggest? 18
2.4.2.4 Demand and Suggest: A Healthy Balance 18
2.4.3 Evolution of the Human-Computer Relationship 18
2.5 A Multi-Device World 19
2.5.1 Spatial Scope of Computing: Devices near and Devices far 19
2.5.2 Body Area Network (BAN) 19
2.5.3 Personal Area Network (PAN) 20
2.5.4 Home Area Network (HAN) 21
2.5.5 Automobile Network 21
2.5.5.1 Controller Area Network (CAN) 21
2.5.6 Near-Me Area Network (NAN) 21
2.5.7 Campus Area Network 22
2.5.8 Metro Area Network 22
2.5.9 Wide Area Network 22
2.5.10 Internet 22
2.5.11 Interplanetary Network 23
2.6 Ubiquitous Computing 23
2.7 Collective, Synergistic Computing Value 23
2.7.1 Importance of the User Centricity and the User Context 23
2.7.2 Distributed Intelligent Personal Assistant 24
2.8 Bright and Cloudy: Cloud-based Intelligent Personal Agent 24
2.8.1 Google / Cloud-Based Intelligent Personal Agent 24
2.9 Leveraging Computer Vision 25
2.9.1 Enhanced Computer Vision / Subtle Change Amplification 25
2.10 IoT and Wearables: Unnatural and over the top? 26
2.10.1 Human History of Tool Use and Computation 27
2.10.2 Communication Networks in Nature 27
2.10.3 Consumption of Power: by computational systems, biological and
artificial 28
2.11 Security and Privacy Issues 28
2.11.1 Use Awareness and complete end-to-end Transparency 29
2.11.2 User Control and Choice 30
2.11.3 User Access to Collected Data and Erasure capability 30
2.11.4 Device side, transit, and cloud side protection: Data Anonymization
30
2.11.5 Practical Considerations: User Centricity 30
2.11.5.1 OpenID 31
2.12 Miscellaneous 31
2.12.1 PhoneBloks: Waste Reduction 31
2.12.1.1 Project "Ara" 31
2.12.2 Google Cardboard: inexpensive Virtual Reality 32
References and Further Reading 32
Part II Foundation Android 35
3 Android Fundamentals / Hello Lollipop 37
3.1 Android: Introduction 37
3.2 Linux: "*nix" or Unix-like OS 38
3.2.1 Unix 38
3.2.2 Open Source 39
3.2.3 GNU / Free Software Foundation 39
3.2.3.1 Free as in Freedom: GNU Public License 40
3.2.4 Apache Software Foundation: Apache Software License 41
3.3 Linux: yesterday and today 41
3.4 Unix System Architecture 41
3.4.1 Unix Processes 42
3.4.1.1 Linux Processes 42
3.4.1.2 Android Processes 42
3.4.1.3 Process Tree 42
3.4.1.4 Unix Interprocess Communication (IPC) 43
3.4.1.5 Remote Procedure Calls (RPC) 44
3.4.2 Unix Kernel 44
3.4.2.1 Linux Kernel 44
3.5 Java 44
3.5.1 Java Origins 45
3.5.2 Java Platform: Language, JVM 45
3.5.3 Java memory: Heap, Stack, and native 45
3.5.4 Security Policy: Permissions 46
3.6 Apache Harmony 46
3.7 Android OS and platform 47
3.7.1 Android Kernel 47
3.7.2 Android Open Source Project (AOSP) 50
3.7.2.1 Android Framework 50
3.7.3 Android Development 50
3.7.3.1 Android SDK 51
3.7.3.2 Android NDK 51
3.7.4 Android Runtime Environment 51
3.7.4.1 Dalvik Virtual Machine 52
3.7.4.2 ART (Android Runtime) 52
3.7.4.3 Zygote 52
3.7.4.4 System Server: Android System Services 53
3.7.5 Android Interface Definition Language (AIDL) 53
3.8 Setting up your Android Development Environment 54
3.8.1 Installing Java SDK version 7 (JDK 1.7) from Sun Microsystems /
Oracle 54
3.8.2 Installing Android SDK from Google 56
3.8.3 Installing Build Tools (gradle and ant) 63
3.8.4 Setting up environment variables (Java, Android SDK, gradle and ant)
63
3.8.5 Android (Lollipop) Development Device setup 64
3.8.5.1 Creating a new Android project (classic / ant) 65
3.8.5.2 Creating a new Android project (new / gradle) 71
3.8.6 Installing Android Studio "IDE" 72
3.8.7 Android Studio: Hello World App 76
3.8.8 Configuring Android Studio 81
3.9 Android "Classic" project tree and build system 82
3.10 Android "New" Build System 82
3.11 Managing Java Installations 83
3.11.1 Avoid sudo apt-get / rpm style installation 83
3.11.2 Maintain discrete Java JDK versions 83
3.11.3 Set JAVA_HOME in your .profile 84
3.11.4 Project-wise JAVA_HOME 84
3.11.5 IDE independent build 84
3.12 Managing Android SDK installation and updates 84
3.12.1 Update your Android SDK often 84
3.12.2 Target your App to the latest SDK / API level 85
3.12.3 Be sure to specify a minimum SDK / API level for your App 85
3.13 Code Samples: Android Lollipop 85
References and Further Reading 85
4 Android SDK 87
4.1 Software Components, in general 87
4.2 Android Application Development Model 88
4.2.1 DEX file format 88
4.2.2 APK file 88
4.2.3 Android Project Build Process 90
4.2.4 APK installation and execution 90
4.2.4.1 Application main thread / UI thread 91
4.3 Android SDK API 91
4.3.1 Android Application Manifest (AndroidManifest.xml) 92
4.3.2 Android API package Overview 92
4.4 Android's Four Fundamental Components 93
4.4.1 Android Project Artifacts 94
4.5 Activity 94
4.5.1 Activity life cycle 96
4.6 Service 98
4.7 BroadcastReceiver 100
4.8 ContentProvider 100
4.9 Intent 101
4.9.1 Intent Action and Data 104
4.9.1.1 Intent Extras 104
4.9.1.2 Intent Flags 104
4.9.2 Explicit Intents 105
4.9.3 Implicit Intents 105
4.9.4 Intent Filter 105
4.9.5 Intent Resolution 106
4.9.6 Intent Use Cases 106
4.9.6.1 Starting Activities 106
4.9.6.2 Starting Services 106
4.9.6.3 Delivering Broadcasts 106
4.10 android package, sub-packages 107
4.11 dalvik package, sub-packages 107
4.12 java and javax package, sub-packages 108
4.13 org package, sub-packages 108
4.14 Sample code in this book 109
References and Further Reading 109
5 Android Device Discovery and Communication 111
5.1 Android Interconnectivity 111
5.2 Advertisement and Discovery 112
5.3 Bluetooth 112
5.3.1 Bluetooth Low Energy (LE) 112
5.3.2 Bluetooth Generic Attribute Profiles (GATT) 112
5.3.3 Android support for Bluetooth LE 113
5.4 Wi-Fi Peer-to-Peer (Wi-Fi Direct) 113
5.4.1 Android Wi-Fi Direct / P2P API 114
5.5 Zero Configuration Networking (zeroconf) 114
5.5.1 Android Network Service Discovery (NSD) 115
5.6 Near Field Communication (NFC) 115
5.7 Universal Serial Bus (USB) 116
5.7.1 USB On-The-Go (USB OTG) 116
References and Further Reading 116
Part III Android Wear Platform and SDK 119
6 Android Wear Platform 121
6.1 Android Wear 121
6.2 Android Wear Platform: Android Wear OS,
Wear Devices, and Wear API 122
6.2.1 Android Wear OS 122
6.2.2 Android Wear Devices 122
6.2.3 Android Wear API and Wear Apps 123
6.3 Android Notifications and Android Wear 123
6.3.1 Android 5.0 (Lollipop) Notifications 124
6.4 Notification Settings and Control 126
6.4.1 Sound and Notification and Priority Notification 126
6.4.2 Notification Configuration and Control 129
6.4.3 Locked Screen and Notifications 131
6.4.3.1 Notification Access 134
6.4.4 Interruptions 135
6.5 App Notification Strategy 136
6.6 Google Now and Android Wear 137
6.7 Android Wear Devices: Getting Started 138
6.7.1 Android SDK Wear Platform updates 138
6.7.2 Procuring an Android Wear device 139
6.7.2.1 Using Android Emulator with Wear AVD 140
6.7.3 Pairing and Enabling Developer Mode 145
6.7.3.1 Unboxing your Wear device 145
6.7.3.2 Pairing your Handheld device with your Wear device 145
6.7.3.3 Enabling Developer Mode and Debugging Settings on your Wear device
150
6.7.3.4 Enabling Wear ADB Debugging and Debug over Bluetooth 153
6.8 Wear Debugging and Android SDK 155
6.8.1 Wear Debugging via USB 155
6.8.2 Wear Debugging via Bluetooth 158
6.9 Peeking under the hood of your Wear Device 161
6.10 Engaging your Android Wear device via Notifications 163
6.10.1 Engaging Android Wear via Notification Sync 163
6.10.2 Wear Extended Notifications 163
6.11 Android Wear Targeted Apps 165
6.12 Hello Wear World: Writing our first Wear App 165
References and Further Reading 168
7 Android Wear API 169
7.1 Google Services and Google Play Services 169
7.1.1 GoogleApiClient class 171
7.2 Android Wear Network 173
7.3 Android Wear API, in depth 173
7.3.1 Wear API: wearable package 174
7.3.1.1 Node interface 174
7.3.1.2 WearableListenerService 174
7.3.1.3 DataEvent 175
7.3.1.4 MessageEvent 175
7.3.2 Wearable class 176
7.3.3 NodeApi 177
7.3.4 DataApi 177
7.4 DataItem, DataMapItem, and DataMap 178
7.4.1 DataItem 178
7.4.2 DataMapItem 180
7.4.3 DataMap 180
7.5 PutDataRequest and PutDataMapRequest 180
7.5.1 PutDataRequest 180
7.5.2 PutDataMapRequest 180
7.6 Asset and DataItemAsset 182
7.6.1 Asset class 182
7.6.2 DataItemAsset interface 182
7.7 MessageApi 183
7.8 Wearable UI Library 184
7.9 Wear Interaction Design 185
7.10 Accessing Sensors 186
7.11 Production Wear Apps 187
References and Further Reading 187
Part IV Google Fit Platform and SDK 189
8 Google Fit Platform 191
8.1 Google Fit Platform Overview 191
8.2 Google Fit Core Concepts 192
8.3 Fit Data Types 192
8.4 Fit Data Store (Storage) 193
8.5 Sensors 193
8.6 Permissions, User Consent 194
8.6.1 Permission Groups, Fitness Scopes 194
8.6.1.1 Activity Scope 194
8.6.1.2 Body Scope 194
8.6.1.3 Location Scope 194
8.7 Google Fit: Developer Responsibilities 195
8.7.1 Developer Terms and Conditions 195
8.7.2 Developer Branding Guidelines 195
8.8 Procuring Sensor Peripherals 195
8.9 Hello Fit: hands-on example 195
8.9.1 Google Play Services library project, dependency 196
8.9.2 Using the SHA1 fingerprint of the keystore 198
8.9.3 Google Developer's Console Activating Fit API 200
8.9.4 Creating the Android App 202
8.10 Google's Fit App 211
8.11 Google Settings App 211
References and Further Reading 212
9 Google Fit API 213
9.1 Google Fit API 213
9.2 Google fit main package (com.google.android.gms.fitness) 213
9.2.1 Fitness class 214
9.2.2 FitnessActivities class 216
9.2.3 FitnessStatusCodes class 216
9.2.4 BleApi interface 217
9.2.5 SensorsApi 218
9.2.6 RecordingApi 219
9.2.7 SessionsApi 220
9.2.8 HistoryApi 221
9.2.9 ConfigApi 222
9.3 data sub-package 223
9.3.1 Device 223
9.3.2 BleDevice 223
9.3.3 DataSource 224
9.3.4 DataType 225
9.3.5 DataPoint 225
9.3.6 Field 227
9.3.7 Value 228
9.3.8 Subscription 228
9.3.9 DataSet 229
9.3.10 Session 230
9.3.11 Bucket 230
9.4 request sub-package 231
9.4.1 StartBleScanRequest 232
9.4.2 BleScanCallback 233
9.4.3 SensorRequest 233
9.4.4 DataSourcesRequest 233
9.4.5 OnDataPointListener 234
9.4.6 DataReadRequest 234
9.4.7 DataDeleteRequest 235
9.4.8 SessionInsertRequest 236
9.4.9 SessionReadRequest 236
9.4.10 DataTypeCreateRequest 236
9.5 result sub-package 236
9.5.1 BleDevicesResult 237
9.5.2 DataSourcesResult 238
9.5.3 ListSubscriptionsResult 238
9.5.4 DataReadResult 238
9.5.5 SessionReadResult 239
9.5.6 SessionStopResult 239
9.5.7 DataTypeResult 239
9.6 service sub-package 240
9.6.1 FitnessSensorService 242
9.6.2 FitnessSensorServiceRequest 242
9.6.3 SensorEventDispatcher interface 243
References and Further Reading 243
Part V Real-World Applications 245
10 Real-World Applications 247
10.1 Real-World Applications 247
10.2 Handheld Application Extension 247
10.3 Home Automation 247
10.3.1 Home Entertainment 248
10.3.2 Gaming 248
10.4 Wearables at the Workplace 248
10.5 Fitness, Health, and Medical 248
10.5.1 Predictive and Proactive Consumer Health 249
10.5.2 Wearables for Medical Professionals 249
10.5.3 Wearables and Remote Medical Diagnostics 249
10.6 Industrial Manufacturing 250
10.7 Civic, Government, and Democracy 250
References and Further Reading 250
Index 251
About the Author xv
About This Book xvii
Acknowledgments xxiii
Part I Wearable Computing: Introduction and Background 1
1 Wearables: Introduction 3
1.1 Wearable Computing 3
1.2 Wearable Computers and Technology 3
1.3 "Wearables" 4
1.4 The word: "Wearables" 4
1.5 Wearables and Smartphones 5
1.6 Wearable Light, Glanceable Interactions 5
1.7 Smartphone Dependency, Inconveniences 5
1.8 Wearable Interaction 6
1.9 User's Real-world Context 6
1.10 Variety of Wearable Devices 6
1.10.1 Smart Watches 6
1.10.2 Fitness Sensors 7
1.10.3 Smart Jewelry 7
1.11 Android Wear and Google Fit 7
1.11.1 Device / Hardware Purchases 7
References and Further Reading 8
2 Wearable Computing Background and Theory 9
2.1 Wearable Computing History 9
2.1.1 Wearable Computing Pioneers 10
2.1.2 Academic Research at Various Universities 11
2.2 Internet of Things (IoT) and Wearables 11
2.2.1 Machine to Machine (M2M) 13
2.3 Wearables' Mass Market Enablers 13
2.3.1 "ARM-ed" revolution 14
2.3.1.1 ARM alternatives 14
2.3.2 System on Chip (SoC) 14
2.3.3 Human Dependence on Computing 15
2.3.4 Smartphone extensions 15
2.3.5 Sensors 15
2.3.5.1 Micro-Electro-Mechanical Systems (MEMS) Sensors 16
2.4 Human-Computer Interface and Human-Computer Relationship 16
2.4.1 Human-Computer Interface: over the years 16
2.4.2 Human Computer Interaction (HCI): Demand and Suggest 17
2.4.2.1 Demand Paradigm 17
2.4.2.2 Suggest Paradigm 18
2.4.2.3 Demand or Suggest? 18
2.4.2.4 Demand and Suggest: A Healthy Balance 18
2.4.3 Evolution of the Human-Computer Relationship 18
2.5 A Multi-Device World 19
2.5.1 Spatial Scope of Computing: Devices near and Devices far 19
2.5.2 Body Area Network (BAN) 19
2.5.3 Personal Area Network (PAN) 20
2.5.4 Home Area Network (HAN) 21
2.5.5 Automobile Network 21
2.5.5.1 Controller Area Network (CAN) 21
2.5.6 Near-Me Area Network (NAN) 21
2.5.7 Campus Area Network 22
2.5.8 Metro Area Network 22
2.5.9 Wide Area Network 22
2.5.10 Internet 22
2.5.11 Interplanetary Network 23
2.6 Ubiquitous Computing 23
2.7 Collective, Synergistic Computing Value 23
2.7.1 Importance of the User Centricity and the User Context 23
2.7.2 Distributed Intelligent Personal Assistant 24
2.8 Bright and Cloudy: Cloud-based Intelligent Personal Agent 24
2.8.1 Google / Cloud-Based Intelligent Personal Agent 24
2.9 Leveraging Computer Vision 25
2.9.1 Enhanced Computer Vision / Subtle Change Amplification 25
2.10 IoT and Wearables: Unnatural and over the top? 26
2.10.1 Human History of Tool Use and Computation 27
2.10.2 Communication Networks in Nature 27
2.10.3 Consumption of Power: by computational systems, biological and
artificial 28
2.11 Security and Privacy Issues 28
2.11.1 Use Awareness and complete end-to-end Transparency 29
2.11.2 User Control and Choice 30
2.11.3 User Access to Collected Data and Erasure capability 30
2.11.4 Device side, transit, and cloud side protection: Data Anonymization
30
2.11.5 Practical Considerations: User Centricity 30
2.11.5.1 OpenID 31
2.12 Miscellaneous 31
2.12.1 PhoneBloks: Waste Reduction 31
2.12.1.1 Project "Ara" 31
2.12.2 Google Cardboard: inexpensive Virtual Reality 32
References and Further Reading 32
Part II Foundation Android 35
3 Android Fundamentals / Hello Lollipop 37
3.1 Android: Introduction 37
3.2 Linux: "*nix" or Unix-like OS 38
3.2.1 Unix 38
3.2.2 Open Source 39
3.2.3 GNU / Free Software Foundation 39
3.2.3.1 Free as in Freedom: GNU Public License 40
3.2.4 Apache Software Foundation: Apache Software License 41
3.3 Linux: yesterday and today 41
3.4 Unix System Architecture 41
3.4.1 Unix Processes 42
3.4.1.1 Linux Processes 42
3.4.1.2 Android Processes 42
3.4.1.3 Process Tree 42
3.4.1.4 Unix Interprocess Communication (IPC) 43
3.4.1.5 Remote Procedure Calls (RPC) 44
3.4.2 Unix Kernel 44
3.4.2.1 Linux Kernel 44
3.5 Java 44
3.5.1 Java Origins 45
3.5.2 Java Platform: Language, JVM 45
3.5.3 Java memory: Heap, Stack, and native 45
3.5.4 Security Policy: Permissions 46
3.6 Apache Harmony 46
3.7 Android OS and platform 47
3.7.1 Android Kernel 47
3.7.2 Android Open Source Project (AOSP) 50
3.7.2.1 Android Framework 50
3.7.3 Android Development 50
3.7.3.1 Android SDK 51
3.7.3.2 Android NDK 51
3.7.4 Android Runtime Environment 51
3.7.4.1 Dalvik Virtual Machine 52
3.7.4.2 ART (Android Runtime) 52
3.7.4.3 Zygote 52
3.7.4.4 System Server: Android System Services 53
3.7.5 Android Interface Definition Language (AIDL) 53
3.8 Setting up your Android Development Environment 54
3.8.1 Installing Java SDK version 7 (JDK 1.7) from Sun Microsystems /
Oracle 54
3.8.2 Installing Android SDK from Google 56
3.8.3 Installing Build Tools (gradle and ant) 63
3.8.4 Setting up environment variables (Java, Android SDK, gradle and ant)
63
3.8.5 Android (Lollipop) Development Device setup 64
3.8.5.1 Creating a new Android project (classic / ant) 65
3.8.5.2 Creating a new Android project (new / gradle) 71
3.8.6 Installing Android Studio "IDE" 72
3.8.7 Android Studio: Hello World App 76
3.8.8 Configuring Android Studio 81
3.9 Android "Classic" project tree and build system 82
3.10 Android "New" Build System 82
3.11 Managing Java Installations 83
3.11.1 Avoid sudo apt-get / rpm style installation 83
3.11.2 Maintain discrete Java JDK versions 83
3.11.3 Set JAVA_HOME in your .profile 84
3.11.4 Project-wise JAVA_HOME 84
3.11.5 IDE independent build 84
3.12 Managing Android SDK installation and updates 84
3.12.1 Update your Android SDK often 84
3.12.2 Target your App to the latest SDK / API level 85
3.12.3 Be sure to specify a minimum SDK / API level for your App 85
3.13 Code Samples: Android Lollipop 85
References and Further Reading 85
4 Android SDK 87
4.1 Software Components, in general 87
4.2 Android Application Development Model 88
4.2.1 DEX file format 88
4.2.2 APK file 88
4.2.3 Android Project Build Process 90
4.2.4 APK installation and execution 90
4.2.4.1 Application main thread / UI thread 91
4.3 Android SDK API 91
4.3.1 Android Application Manifest (AndroidManifest.xml) 92
4.3.2 Android API package Overview 92
4.4 Android's Four Fundamental Components 93
4.4.1 Android Project Artifacts 94
4.5 Activity 94
4.5.1 Activity life cycle 96
4.6 Service 98
4.7 BroadcastReceiver 100
4.8 ContentProvider 100
4.9 Intent 101
4.9.1 Intent Action and Data 104
4.9.1.1 Intent Extras 104
4.9.1.2 Intent Flags 104
4.9.2 Explicit Intents 105
4.9.3 Implicit Intents 105
4.9.4 Intent Filter 105
4.9.5 Intent Resolution 106
4.9.6 Intent Use Cases 106
4.9.6.1 Starting Activities 106
4.9.6.2 Starting Services 106
4.9.6.3 Delivering Broadcasts 106
4.10 android package, sub-packages 107
4.11 dalvik package, sub-packages 107
4.12 java and javax package, sub-packages 108
4.13 org package, sub-packages 108
4.14 Sample code in this book 109
References and Further Reading 109
5 Android Device Discovery and Communication 111
5.1 Android Interconnectivity 111
5.2 Advertisement and Discovery 112
5.3 Bluetooth 112
5.3.1 Bluetooth Low Energy (LE) 112
5.3.2 Bluetooth Generic Attribute Profiles (GATT) 112
5.3.3 Android support for Bluetooth LE 113
5.4 Wi-Fi Peer-to-Peer (Wi-Fi Direct) 113
5.4.1 Android Wi-Fi Direct / P2P API 114
5.5 Zero Configuration Networking (zeroconf) 114
5.5.1 Android Network Service Discovery (NSD) 115
5.6 Near Field Communication (NFC) 115
5.7 Universal Serial Bus (USB) 116
5.7.1 USB On-The-Go (USB OTG) 116
References and Further Reading 116
Part III Android Wear Platform and SDK 119
6 Android Wear Platform 121
6.1 Android Wear 121
6.2 Android Wear Platform: Android Wear OS,
Wear Devices, and Wear API 122
6.2.1 Android Wear OS 122
6.2.2 Android Wear Devices 122
6.2.3 Android Wear API and Wear Apps 123
6.3 Android Notifications and Android Wear 123
6.3.1 Android 5.0 (Lollipop) Notifications 124
6.4 Notification Settings and Control 126
6.4.1 Sound and Notification and Priority Notification 126
6.4.2 Notification Configuration and Control 129
6.4.3 Locked Screen and Notifications 131
6.4.3.1 Notification Access 134
6.4.4 Interruptions 135
6.5 App Notification Strategy 136
6.6 Google Now and Android Wear 137
6.7 Android Wear Devices: Getting Started 138
6.7.1 Android SDK Wear Platform updates 138
6.7.2 Procuring an Android Wear device 139
6.7.2.1 Using Android Emulator with Wear AVD 140
6.7.3 Pairing and Enabling Developer Mode 145
6.7.3.1 Unboxing your Wear device 145
6.7.3.2 Pairing your Handheld device with your Wear device 145
6.7.3.3 Enabling Developer Mode and Debugging Settings on your Wear device
150
6.7.3.4 Enabling Wear ADB Debugging and Debug over Bluetooth 153
6.8 Wear Debugging and Android SDK 155
6.8.1 Wear Debugging via USB 155
6.8.2 Wear Debugging via Bluetooth 158
6.9 Peeking under the hood of your Wear Device 161
6.10 Engaging your Android Wear device via Notifications 163
6.10.1 Engaging Android Wear via Notification Sync 163
6.10.2 Wear Extended Notifications 163
6.11 Android Wear Targeted Apps 165
6.12 Hello Wear World: Writing our first Wear App 165
References and Further Reading 168
7 Android Wear API 169
7.1 Google Services and Google Play Services 169
7.1.1 GoogleApiClient class 171
7.2 Android Wear Network 173
7.3 Android Wear API, in depth 173
7.3.1 Wear API: wearable package 174
7.3.1.1 Node interface 174
7.3.1.2 WearableListenerService 174
7.3.1.3 DataEvent 175
7.3.1.4 MessageEvent 175
7.3.2 Wearable class 176
7.3.3 NodeApi 177
7.3.4 DataApi 177
7.4 DataItem, DataMapItem, and DataMap 178
7.4.1 DataItem 178
7.4.2 DataMapItem 180
7.4.3 DataMap 180
7.5 PutDataRequest and PutDataMapRequest 180
7.5.1 PutDataRequest 180
7.5.2 PutDataMapRequest 180
7.6 Asset and DataItemAsset 182
7.6.1 Asset class 182
7.6.2 DataItemAsset interface 182
7.7 MessageApi 183
7.8 Wearable UI Library 184
7.9 Wear Interaction Design 185
7.10 Accessing Sensors 186
7.11 Production Wear Apps 187
References and Further Reading 187
Part IV Google Fit Platform and SDK 189
8 Google Fit Platform 191
8.1 Google Fit Platform Overview 191
8.2 Google Fit Core Concepts 192
8.3 Fit Data Types 192
8.4 Fit Data Store (Storage) 193
8.5 Sensors 193
8.6 Permissions, User Consent 194
8.6.1 Permission Groups, Fitness Scopes 194
8.6.1.1 Activity Scope 194
8.6.1.2 Body Scope 194
8.6.1.3 Location Scope 194
8.7 Google Fit: Developer Responsibilities 195
8.7.1 Developer Terms and Conditions 195
8.7.2 Developer Branding Guidelines 195
8.8 Procuring Sensor Peripherals 195
8.9 Hello Fit: hands-on example 195
8.9.1 Google Play Services library project, dependency 196
8.9.2 Using the SHA1 fingerprint of the keystore 198
8.9.3 Google Developer's Console Activating Fit API 200
8.9.4 Creating the Android App 202
8.10 Google's Fit App 211
8.11 Google Settings App 211
References and Further Reading 212
9 Google Fit API 213
9.1 Google Fit API 213
9.2 Google fit main package (com.google.android.gms.fitness) 213
9.2.1 Fitness class 214
9.2.2 FitnessActivities class 216
9.2.3 FitnessStatusCodes class 216
9.2.4 BleApi interface 217
9.2.5 SensorsApi 218
9.2.6 RecordingApi 219
9.2.7 SessionsApi 220
9.2.8 HistoryApi 221
9.2.9 ConfigApi 222
9.3 data sub-package 223
9.3.1 Device 223
9.3.2 BleDevice 223
9.3.3 DataSource 224
9.3.4 DataType 225
9.3.5 DataPoint 225
9.3.6 Field 227
9.3.7 Value 228
9.3.8 Subscription 228
9.3.9 DataSet 229
9.3.10 Session 230
9.3.11 Bucket 230
9.4 request sub-package 231
9.4.1 StartBleScanRequest 232
9.4.2 BleScanCallback 233
9.4.3 SensorRequest 233
9.4.4 DataSourcesRequest 233
9.4.5 OnDataPointListener 234
9.4.6 DataReadRequest 234
9.4.7 DataDeleteRequest 235
9.4.8 SessionInsertRequest 236
9.4.9 SessionReadRequest 236
9.4.10 DataTypeCreateRequest 236
9.5 result sub-package 236
9.5.1 BleDevicesResult 237
9.5.2 DataSourcesResult 238
9.5.3 ListSubscriptionsResult 238
9.5.4 DataReadResult 238
9.5.5 SessionReadResult 239
9.5.6 SessionStopResult 239
9.5.7 DataTypeResult 239
9.6 service sub-package 240
9.6.1 FitnessSensorService 242
9.6.2 FitnessSensorServiceRequest 242
9.6.3 SensorEventDispatcher interface 243
References and Further Reading 243
Part V Real-World Applications 245
10 Real-World Applications 247
10.1 Real-World Applications 247
10.2 Handheld Application Extension 247
10.3 Home Automation 247
10.3.1 Home Entertainment 248
10.3.2 Gaming 248
10.4 Wearables at the Workplace 248
10.5 Fitness, Health, and Medical 248
10.5.1 Predictive and Proactive Consumer Health 249
10.5.2 Wearables for Medical Professionals 249
10.5.3 Wearables and Remote Medical Diagnostics 249
10.6 Industrial Manufacturing 250
10.7 Civic, Government, and Democracy 250
References and Further Reading 250
Index 251
About This Book xvii
Acknowledgments xxiii
Part I Wearable Computing: Introduction and Background 1
1 Wearables: Introduction 3
1.1 Wearable Computing 3
1.2 Wearable Computers and Technology 3
1.3 "Wearables" 4
1.4 The word: "Wearables" 4
1.5 Wearables and Smartphones 5
1.6 Wearable Light, Glanceable Interactions 5
1.7 Smartphone Dependency, Inconveniences 5
1.8 Wearable Interaction 6
1.9 User's Real-world Context 6
1.10 Variety of Wearable Devices 6
1.10.1 Smart Watches 6
1.10.2 Fitness Sensors 7
1.10.3 Smart Jewelry 7
1.11 Android Wear and Google Fit 7
1.11.1 Device / Hardware Purchases 7
References and Further Reading 8
2 Wearable Computing Background and Theory 9
2.1 Wearable Computing History 9
2.1.1 Wearable Computing Pioneers 10
2.1.2 Academic Research at Various Universities 11
2.2 Internet of Things (IoT) and Wearables 11
2.2.1 Machine to Machine (M2M) 13
2.3 Wearables' Mass Market Enablers 13
2.3.1 "ARM-ed" revolution 14
2.3.1.1 ARM alternatives 14
2.3.2 System on Chip (SoC) 14
2.3.3 Human Dependence on Computing 15
2.3.4 Smartphone extensions 15
2.3.5 Sensors 15
2.3.5.1 Micro-Electro-Mechanical Systems (MEMS) Sensors 16
2.4 Human-Computer Interface and Human-Computer Relationship 16
2.4.1 Human-Computer Interface: over the years 16
2.4.2 Human Computer Interaction (HCI): Demand and Suggest 17
2.4.2.1 Demand Paradigm 17
2.4.2.2 Suggest Paradigm 18
2.4.2.3 Demand or Suggest? 18
2.4.2.4 Demand and Suggest: A Healthy Balance 18
2.4.3 Evolution of the Human-Computer Relationship 18
2.5 A Multi-Device World 19
2.5.1 Spatial Scope of Computing: Devices near and Devices far 19
2.5.2 Body Area Network (BAN) 19
2.5.3 Personal Area Network (PAN) 20
2.5.4 Home Area Network (HAN) 21
2.5.5 Automobile Network 21
2.5.5.1 Controller Area Network (CAN) 21
2.5.6 Near-Me Area Network (NAN) 21
2.5.7 Campus Area Network 22
2.5.8 Metro Area Network 22
2.5.9 Wide Area Network 22
2.5.10 Internet 22
2.5.11 Interplanetary Network 23
2.6 Ubiquitous Computing 23
2.7 Collective, Synergistic Computing Value 23
2.7.1 Importance of the User Centricity and the User Context 23
2.7.2 Distributed Intelligent Personal Assistant 24
2.8 Bright and Cloudy: Cloud-based Intelligent Personal Agent 24
2.8.1 Google / Cloud-Based Intelligent Personal Agent 24
2.9 Leveraging Computer Vision 25
2.9.1 Enhanced Computer Vision / Subtle Change Amplification 25
2.10 IoT and Wearables: Unnatural and over the top? 26
2.10.1 Human History of Tool Use and Computation 27
2.10.2 Communication Networks in Nature 27
2.10.3 Consumption of Power: by computational systems, biological and
artificial 28
2.11 Security and Privacy Issues 28
2.11.1 Use Awareness and complete end-to-end Transparency 29
2.11.2 User Control and Choice 30
2.11.3 User Access to Collected Data and Erasure capability 30
2.11.4 Device side, transit, and cloud side protection: Data Anonymization
30
2.11.5 Practical Considerations: User Centricity 30
2.11.5.1 OpenID 31
2.12 Miscellaneous 31
2.12.1 PhoneBloks: Waste Reduction 31
2.12.1.1 Project "Ara" 31
2.12.2 Google Cardboard: inexpensive Virtual Reality 32
References and Further Reading 32
Part II Foundation Android 35
3 Android Fundamentals / Hello Lollipop 37
3.1 Android: Introduction 37
3.2 Linux: "*nix" or Unix-like OS 38
3.2.1 Unix 38
3.2.2 Open Source 39
3.2.3 GNU / Free Software Foundation 39
3.2.3.1 Free as in Freedom: GNU Public License 40
3.2.4 Apache Software Foundation: Apache Software License 41
3.3 Linux: yesterday and today 41
3.4 Unix System Architecture 41
3.4.1 Unix Processes 42
3.4.1.1 Linux Processes 42
3.4.1.2 Android Processes 42
3.4.1.3 Process Tree 42
3.4.1.4 Unix Interprocess Communication (IPC) 43
3.4.1.5 Remote Procedure Calls (RPC) 44
3.4.2 Unix Kernel 44
3.4.2.1 Linux Kernel 44
3.5 Java 44
3.5.1 Java Origins 45
3.5.2 Java Platform: Language, JVM 45
3.5.3 Java memory: Heap, Stack, and native 45
3.5.4 Security Policy: Permissions 46
3.6 Apache Harmony 46
3.7 Android OS and platform 47
3.7.1 Android Kernel 47
3.7.2 Android Open Source Project (AOSP) 50
3.7.2.1 Android Framework 50
3.7.3 Android Development 50
3.7.3.1 Android SDK 51
3.7.3.2 Android NDK 51
3.7.4 Android Runtime Environment 51
3.7.4.1 Dalvik Virtual Machine 52
3.7.4.2 ART (Android Runtime) 52
3.7.4.3 Zygote 52
3.7.4.4 System Server: Android System Services 53
3.7.5 Android Interface Definition Language (AIDL) 53
3.8 Setting up your Android Development Environment 54
3.8.1 Installing Java SDK version 7 (JDK 1.7) from Sun Microsystems /
Oracle 54
3.8.2 Installing Android SDK from Google 56
3.8.3 Installing Build Tools (gradle and ant) 63
3.8.4 Setting up environment variables (Java, Android SDK, gradle and ant)
63
3.8.5 Android (Lollipop) Development Device setup 64
3.8.5.1 Creating a new Android project (classic / ant) 65
3.8.5.2 Creating a new Android project (new / gradle) 71
3.8.6 Installing Android Studio "IDE" 72
3.8.7 Android Studio: Hello World App 76
3.8.8 Configuring Android Studio 81
3.9 Android "Classic" project tree and build system 82
3.10 Android "New" Build System 82
3.11 Managing Java Installations 83
3.11.1 Avoid sudo apt-get / rpm style installation 83
3.11.2 Maintain discrete Java JDK versions 83
3.11.3 Set JAVA_HOME in your .profile 84
3.11.4 Project-wise JAVA_HOME 84
3.11.5 IDE independent build 84
3.12 Managing Android SDK installation and updates 84
3.12.1 Update your Android SDK often 84
3.12.2 Target your App to the latest SDK / API level 85
3.12.3 Be sure to specify a minimum SDK / API level for your App 85
3.13 Code Samples: Android Lollipop 85
References and Further Reading 85
4 Android SDK 87
4.1 Software Components, in general 87
4.2 Android Application Development Model 88
4.2.1 DEX file format 88
4.2.2 APK file 88
4.2.3 Android Project Build Process 90
4.2.4 APK installation and execution 90
4.2.4.1 Application main thread / UI thread 91
4.3 Android SDK API 91
4.3.1 Android Application Manifest (AndroidManifest.xml) 92
4.3.2 Android API package Overview 92
4.4 Android's Four Fundamental Components 93
4.4.1 Android Project Artifacts 94
4.5 Activity 94
4.5.1 Activity life cycle 96
4.6 Service 98
4.7 BroadcastReceiver 100
4.8 ContentProvider 100
4.9 Intent 101
4.9.1 Intent Action and Data 104
4.9.1.1 Intent Extras 104
4.9.1.2 Intent Flags 104
4.9.2 Explicit Intents 105
4.9.3 Implicit Intents 105
4.9.4 Intent Filter 105
4.9.5 Intent Resolution 106
4.9.6 Intent Use Cases 106
4.9.6.1 Starting Activities 106
4.9.6.2 Starting Services 106
4.9.6.3 Delivering Broadcasts 106
4.10 android package, sub-packages 107
4.11 dalvik package, sub-packages 107
4.12 java and javax package, sub-packages 108
4.13 org package, sub-packages 108
4.14 Sample code in this book 109
References and Further Reading 109
5 Android Device Discovery and Communication 111
5.1 Android Interconnectivity 111
5.2 Advertisement and Discovery 112
5.3 Bluetooth 112
5.3.1 Bluetooth Low Energy (LE) 112
5.3.2 Bluetooth Generic Attribute Profiles (GATT) 112
5.3.3 Android support for Bluetooth LE 113
5.4 Wi-Fi Peer-to-Peer (Wi-Fi Direct) 113
5.4.1 Android Wi-Fi Direct / P2P API 114
5.5 Zero Configuration Networking (zeroconf) 114
5.5.1 Android Network Service Discovery (NSD) 115
5.6 Near Field Communication (NFC) 115
5.7 Universal Serial Bus (USB) 116
5.7.1 USB On-The-Go (USB OTG) 116
References and Further Reading 116
Part III Android Wear Platform and SDK 119
6 Android Wear Platform 121
6.1 Android Wear 121
6.2 Android Wear Platform: Android Wear OS,
Wear Devices, and Wear API 122
6.2.1 Android Wear OS 122
6.2.2 Android Wear Devices 122
6.2.3 Android Wear API and Wear Apps 123
6.3 Android Notifications and Android Wear 123
6.3.1 Android 5.0 (Lollipop) Notifications 124
6.4 Notification Settings and Control 126
6.4.1 Sound and Notification and Priority Notification 126
6.4.2 Notification Configuration and Control 129
6.4.3 Locked Screen and Notifications 131
6.4.3.1 Notification Access 134
6.4.4 Interruptions 135
6.5 App Notification Strategy 136
6.6 Google Now and Android Wear 137
6.7 Android Wear Devices: Getting Started 138
6.7.1 Android SDK Wear Platform updates 138
6.7.2 Procuring an Android Wear device 139
6.7.2.1 Using Android Emulator with Wear AVD 140
6.7.3 Pairing and Enabling Developer Mode 145
6.7.3.1 Unboxing your Wear device 145
6.7.3.2 Pairing your Handheld device with your Wear device 145
6.7.3.3 Enabling Developer Mode and Debugging Settings on your Wear device
150
6.7.3.4 Enabling Wear ADB Debugging and Debug over Bluetooth 153
6.8 Wear Debugging and Android SDK 155
6.8.1 Wear Debugging via USB 155
6.8.2 Wear Debugging via Bluetooth 158
6.9 Peeking under the hood of your Wear Device 161
6.10 Engaging your Android Wear device via Notifications 163
6.10.1 Engaging Android Wear via Notification Sync 163
6.10.2 Wear Extended Notifications 163
6.11 Android Wear Targeted Apps 165
6.12 Hello Wear World: Writing our first Wear App 165
References and Further Reading 168
7 Android Wear API 169
7.1 Google Services and Google Play Services 169
7.1.1 GoogleApiClient class 171
7.2 Android Wear Network 173
7.3 Android Wear API, in depth 173
7.3.1 Wear API: wearable package 174
7.3.1.1 Node interface 174
7.3.1.2 WearableListenerService 174
7.3.1.3 DataEvent 175
7.3.1.4 MessageEvent 175
7.3.2 Wearable class 176
7.3.3 NodeApi 177
7.3.4 DataApi 177
7.4 DataItem, DataMapItem, and DataMap 178
7.4.1 DataItem 178
7.4.2 DataMapItem 180
7.4.3 DataMap 180
7.5 PutDataRequest and PutDataMapRequest 180
7.5.1 PutDataRequest 180
7.5.2 PutDataMapRequest 180
7.6 Asset and DataItemAsset 182
7.6.1 Asset class 182
7.6.2 DataItemAsset interface 182
7.7 MessageApi 183
7.8 Wearable UI Library 184
7.9 Wear Interaction Design 185
7.10 Accessing Sensors 186
7.11 Production Wear Apps 187
References and Further Reading 187
Part IV Google Fit Platform and SDK 189
8 Google Fit Platform 191
8.1 Google Fit Platform Overview 191
8.2 Google Fit Core Concepts 192
8.3 Fit Data Types 192
8.4 Fit Data Store (Storage) 193
8.5 Sensors 193
8.6 Permissions, User Consent 194
8.6.1 Permission Groups, Fitness Scopes 194
8.6.1.1 Activity Scope 194
8.6.1.2 Body Scope 194
8.6.1.3 Location Scope 194
8.7 Google Fit: Developer Responsibilities 195
8.7.1 Developer Terms and Conditions 195
8.7.2 Developer Branding Guidelines 195
8.8 Procuring Sensor Peripherals 195
8.9 Hello Fit: hands-on example 195
8.9.1 Google Play Services library project, dependency 196
8.9.2 Using the SHA1 fingerprint of the keystore 198
8.9.3 Google Developer's Console Activating Fit API 200
8.9.4 Creating the Android App 202
8.10 Google's Fit App 211
8.11 Google Settings App 211
References and Further Reading 212
9 Google Fit API 213
9.1 Google Fit API 213
9.2 Google fit main package (com.google.android.gms.fitness) 213
9.2.1 Fitness class 214
9.2.2 FitnessActivities class 216
9.2.3 FitnessStatusCodes class 216
9.2.4 BleApi interface 217
9.2.5 SensorsApi 218
9.2.6 RecordingApi 219
9.2.7 SessionsApi 220
9.2.8 HistoryApi 221
9.2.9 ConfigApi 222
9.3 data sub-package 223
9.3.1 Device 223
9.3.2 BleDevice 223
9.3.3 DataSource 224
9.3.4 DataType 225
9.3.5 DataPoint 225
9.3.6 Field 227
9.3.7 Value 228
9.3.8 Subscription 228
9.3.9 DataSet 229
9.3.10 Session 230
9.3.11 Bucket 230
9.4 request sub-package 231
9.4.1 StartBleScanRequest 232
9.4.2 BleScanCallback 233
9.4.3 SensorRequest 233
9.4.4 DataSourcesRequest 233
9.4.5 OnDataPointListener 234
9.4.6 DataReadRequest 234
9.4.7 DataDeleteRequest 235
9.4.8 SessionInsertRequest 236
9.4.9 SessionReadRequest 236
9.4.10 DataTypeCreateRequest 236
9.5 result sub-package 236
9.5.1 BleDevicesResult 237
9.5.2 DataSourcesResult 238
9.5.3 ListSubscriptionsResult 238
9.5.4 DataReadResult 238
9.5.5 SessionReadResult 239
9.5.6 SessionStopResult 239
9.5.7 DataTypeResult 239
9.6 service sub-package 240
9.6.1 FitnessSensorService 242
9.6.2 FitnessSensorServiceRequest 242
9.6.3 SensorEventDispatcher interface 243
References and Further Reading 243
Part V Real-World Applications 245
10 Real-World Applications 247
10.1 Real-World Applications 247
10.2 Handheld Application Extension 247
10.3 Home Automation 247
10.3.1 Home Entertainment 248
10.3.2 Gaming 248
10.4 Wearables at the Workplace 248
10.5 Fitness, Health, and Medical 248
10.5.1 Predictive and Proactive Consumer Health 249
10.5.2 Wearables for Medical Professionals 249
10.5.3 Wearables and Remote Medical Diagnostics 249
10.6 Industrial Manufacturing 250
10.7 Civic, Government, and Democracy 250
References and Further Reading 250
Index 251