Institutionen För Datavetenskap Cross-Platform Development For
Total Page:16
File Type:pdf, Size:1020Kb
Institutionen f¨ordatavetenskap Department of Computer and Information Science Final thesis Cross-platform Development for Wearable Devices by Gustav Beck-Nor´en LIU-IDA/LITH-EX-A{15/038{SE 2015-06-10 Linköpings universitet Linköpings universitet SE-581 83 Linköping, Sweden 581 83 Linköping Link¨opingsuniversitet Institutionen f¨ordatavetenskap Final thesis Cross-platform Development for Wearable Devices by Gustav Beck-Nor´en LIU-IDA/LITH-EX-A{15/038{SE 2015-06-10 Supervisor: Magnus B˚ang,Link¨opingUniversity Niklas Bj¨ork´en,Accedo Broadband AB Examiner: Rita Kovordanyi, Link¨opingUniversity Abstract The market for wearable devices is continuously growing and has seen an in- crease in interest and demand this past year, specifically smartwatch devices. With several big players entering and trying to take place in the market the number of devices and platforms grow. This leads to device and software fragmentation like the one seen in the world of smartphones. In this paper I discuss and compare the two smartwatch platforms Android Wear and Apple Watch in terms of possibilities, limitations and differences. Research is done to find cross-platform development possibilities for these platforms. Extensive theoretical background of both APIs is researched and presented. An app for both smartwatch platforms is developed with integration of the WebSocket protocol to function as a remote control for a Video-On-Demand web service. This is done to showcase the cross-platform possibilities and differences of the platforms. As a result the biggest differences are out- lined and a conclusion is made that cross-platform development for these platforms can be challenging but is possible on certain levels. iii Preface I would like to begin by thanking Accedo Broadband AB for giving me the opportunity to perform this master thesis within such an exciting area. A special thanks to my Accedo supervisor Niklas Bj¨ork´enand also Niklas Lavrell for making me feel welcome at Accedo and helping me with feed- back and ideas during this thesis. I would also like to thank my examiner, Rita Kovordanyi, and my opponents, Oskar Eriksson and Emil Rydkvist, at Link¨opingUniversity. It has been very exciting working with smartwatches and it has been a real learning experience. Finally I would like to thank my family and my friends for the encouragement and support during this thesis work and during my studies at Link¨opingUniversity. Gustav Beck-Nor´en Stockholm, June 2015 iv Contents 1 Introduction 2 1.1 Motivation . .2 1.1.1 Wearables . .2 1.1.2 Cross-platform . .3 1.1.3 Accedo . .3 1.2 Purpose and Aim . .4 1.3 Research questions . .5 1.4 Scope and Limitations . .5 1.5 Approach . .6 2 Theoretical Background 7 2.1 Smartwatches . .7 2.1.1 Challenges and Limitations . .8 2.1.2 Second screen . .9 2.2 Cross-platform . .9 2.3 Android Wear . .9 2.3.1 Google Play Services . 11 2.3.2 Architecture . 12 2.4 Apple Watch . 14 2.4.1 WatchKit . 15 2.4.2 WatchKit architecture and life cycles . 17 2.5 Accedo VIA Web . 19 2.5.1 MEAN Stack . 20 2.5.2 Architecture . 21 3 Method 23 3.1 Process . 23 3.1.1 Pre-study . 23 3.1.2 Implementation . 24 3.1.3 Evaluation . 24 v CONTENTS CONTENTS 4 Implementation 25 4.1 Web Server . 25 4.2 VIA Web application . 26 4.3 Android Wear . 28 4.3.1 WebSockets . 28 4.3.2 Native Android Wear . 29 4.3.3 Extended Notification . 31 4.4 Apple Watch . 33 4.4.1 WebSocket . 33 4.4.2 WatchKit App . 34 5 Result 37 5.1 Android Wear . 37 5.1.1 Native Android Wear . 37 5.1.2 Extended Notification . 38 5.2 Apple Watch . 40 6 Cross-platform Evaluation 42 6.1 Approaches . 42 6.1.1 Mobile web application . 42 6.1.2 Hybrid approach . 43 6.1.3 Cross compilation . 43 6.2 Possibilities . 44 7 Discussion 46 7.1 Result and Evaluation . 46 7.1.1 Differences and Similarities . 46 7.1.2 Challenges and Limitations . 48 7.1.3 Cross-platform Evaluation . 48 7.2 Method . 49 8 Conclusion 51 8.1 Future work . 52 A Web server 56 B VIA Web application 59 C Native Android Wear 64 D Android Wear Notification extender 73 E Apple Watch 81 vi List of Figures 2.1 Interaction pattern using a smartphone (Jordan, 2014) . .8 2.2 Interaction pattern using a smartwatch (Jordan, 2014) . .8 2.3 Google Play Services diagram (Google, 2015) . 11 2.4 High level architecture of Android Wear API . 12 2.5 The Data API . 13 2.6 The Data Layer API stack (Hahn, 2015) . 14 2.7 Communication between a WatchKit app and WatchKit ex- tension (Apple, 2015b) . 18 2.8 WatchKit app life cycle (Apple, 2015c) . 19 2.9 Accedo VIA (Accedo, 2015b) . 20 2.10 MEAN stack (Sevilleja, 2015) . 21 2.11 High level architecture of VIA Web . 22 4.1 Use case solution idea . 26 4.2 High level architecture of solution . 27 5.1 Final Native Android Wear Application . 38 5.2 Home screen with notification on wearable and phone . 39 5.3 Final Android Wear Application . 39 5.4 Final Apple Watch Application . 40 5.5 Now Playing Glance on Apple Watch (Apple, 2015a) . 41 1 Chapter 1 Introduction 1.1 Motivation This section covers some short background information about the topics and motivations to why this thesis was performed. 1.1.1 Wearables Wearable technology has been around for a very long time and is a very broad term but can be described as follows. A wearable device is simply a piece of technology that is incorporated in a piece of clothing or in an accessory that can be worn. This includes anything from pedometers em- bedded in shoes and trackers in bracelets, to something like microphone earrings. The wearable technology market had a short upswing and caught the normal consumer's eye in the mid 80s with Casio's wristwatch calcu- lator (Wikipedia, 2015b), but has been fairly absent from the consumer market since. Until now. The launch of Google Glass and the new trends in tracking our movements and habits has sparked a new interest in wearable technology. Healthier lifestyles have sparked the fitness tracker market and the need to be more connected now directs the consumer's gaze towards the smartwatch. In May of 2012 the record-breaking (Kickstarter, 2015) success of the Kickstarter campaign for the Pebble Watch confirmed the indications that the demand for smartwatches is increasing. With technology getting more powerful and affordable the smartwatch, although still struggling, is finally starting to find its area of use and niche. Forbes writes that statistics from GlobalWebIndex says that 71% of those aged 16 to 24 would like to own a piece of wearable tech (smartwatch, smartband or Google Glass) (Lip- man, 2014). Google's (2015) announcement of Android Wear in March of 2014 with partners such as Samsung, LG, Motorola, HTC and Asus, and the revealing of Apple Watch by Apple in September the same year makes it clear that non wants to miss the launch of the smartwatch market. With 2 1.1. MOTIVATION CHAPTER 1. INTRODUCTION all of the big players in the mobile industry diving into the area of smart- watches the innovation and number of devices available on the market is increasing rapidly. A report released in February by the market intelligence firm Tractica (2015) says that the "Smart Watch Shipments Will More than Quadruple in 2015, Reaching 24.4 Million Units Worldwide". This follows the smartwatch market forecast done by NextMarket (2013) which states the growth will continue year over year. The demand to wear a smartwatch on the wrist never been higher. With these new platforms launching on hardware devices that have not existed in this format before a lot of questions arises. As of starting this thesis work the Android Wear platform is fairly immature and Apple's WatchKit is only in early Beta. Not much is known about the respective API's and the limitations and differences between these new platforms. This is why this has to be thoroughly investigated. 1.1.2 Cross-platform In the world of mobile application development fragmentation between dif- ferent platforms and operating systems is becoming an increasingly large challenge for developers to overcome (Arthur, 2014). The term cross-platform refers to code, components or entire applications which can be run on on multiple different platforms. Having an application function on both the Android platform and the iOS platform simultaneously for instance is con- sidered cross-platform. This is no different in the world of wearables, specif- ically smartwatches. The smartwatch platform brings additional aspects into consideration with even more variety between models and brands than smartphones, with different form factors, functionalities and sensors. A key challenge for app developers across the world will be to ensure device com- patibility for maximum reach. This can be more complicated than it might seem at first glance. There are three major platforms today in the smart- watch market: Android Wear, Pebble OS and Watch OS (Apple Watch). But confusingly, even though LG and Samsung are listed as Android Wear partners, some of their devices are running their own operating systems. For example the LG Watch Urbane LTE is running an operating system based on WebOS and multiple Samsung devices are running a Tizen-based operat- ing system using the Samsung Gear SDK. The company Accedo Broadband faces this problem of platform fragmentation on a daily basis.