Professional Documents
Culture Documents
FULLTEXT01
FULLTEXT01
CREDITS
STOCKHOLM, SWEDEN 2020
ANDERS NILSSON
ANDERS NILSSON
Abstract
Mobile platform fragmentation is one of the main challenges of mobile
development today, forcing developers to develop one application for each
targeted platform, which significantly impacts time and cost for application
development and maintenance. The fragmentation has given rise to cross-
platform application development tools and frameworks, making it possible
to develop one single application compatible with several platforms. This
thesis focuses on the web-based approach Progressive Web Applications
(PWAs), which, in contrast to previous approaches, targets both mobile
and desktop devices. We aim to point out the supported features, evaluate
their suitability for QR code scanning, and their performance compared to
alternative approaches on iOS. We specifically cover a feature set of 33 features
and measure response times, CPU and memory utilization, geolocation
accuracy, and QR code scanning correctness. We developed three benchmark
artifacts for the performance analysis: a PWA, a React Native application, and
a native iOS application, and conducted automated run-time experiments using
the tools Xcode and XCUITest.
The performance evaluation shows that native applications performed
best in memory and CPU utilization, whereas React Native achieved the
shortest response times. The feature evaluation shows that the majority of the
features are supported or partially supported for PWAs, and that the support
continues to grow. Still, PWAs lack support for crucial mobile features such as
push notifications and background synchronization, making PWAs insufficient
for advanced mobile application development on iOS. Nevertheless, this
study shows that PWAs are well worth considering for applications with low
requirements.
ii | Abstract
Keywords
Mobile application development, Cross-platform tools, Progressive Web
Applications, Performance analysis, iOS, QR code scanning
Sammanfattning | iii
Sammanfattning
Fragmentering av mobilplattformar är en av de största utmaningarna inom
mobilutveckling, vilket tvingar utvecklare att utveckla en applikation för
varje specific plattform, vilket avsevärt påverkar tid och kostnad för
applikationsutveckling och underhåll. Fragmenteringen har gett upphov
till plattformsoberoende applikationsutvecklingsverktyg och ramverk, vilka
möjliggör utveckling av en enda applikation kompatibel med flertalet
plattformar. Det här examensarbetet fokuserar på det webbaserade tillvä-
gagångssättet Progressiva Webb Applikationers (PWAs), som till skillnad
från tidigare tillvägagångssätt, riktar sig till både mobila och stationära
enheter. Den här studien syftar till att reda ut vilka funktioner som stöds av
PWAs, utvärdera PWAs lämplighet för QR-kodskanning och deras prestanda
jämfört med alternativa tillvägagångssätt på iOS. Mer specifikt täcker
den här stiduen en evaluering av 33 essentiella mobilfunktioner samt en
prestandaanalys genom mätning av svarstid, CPU- och minnesanvändning,
geolokaliseringsnoggrannhet och QR-kodsskanning korrekthet. Vi utvecklade
tre benchmark-artefakter för prestandaanalysen: en PWA, en React Native-
applikation och en inbyggd iOS-applikation, och genomförde automatiserade
experiment med verktygen Xcode och XCUITest.
Prestandautvärderingen visar att inbyggda applikationer presterade bäst
i minne och CPU-användning, medan React Native uppnådde de kortaste
svarstiderna. Funktionsutvärderingen visar att majoriteten av funktionerna
stöds eller delvis stöds för PWAs, och att stödet fortsätter att växa. Ändå
saknar PWAs stöd för viktiga mobila funktioner som push-meddelanden och
bakgrundssynkronisering, vilket gör PWAs otillräckliga för utveckling av
avancerade iOS mobilapplikationer. Däremot är PWAs väl värda att överväga
för applikationer med lägre krav.
Nyckelord
Mobilappsutveckling, plattformsoberoende verktyg, progressiva webbappli-
kationer, prestandaanalys, iOS, QR-skanning
iv | Sammanfattning
Acknowledgments | v
Acknowledgments
First, I would like to thank all the people who helped me conduct my thesis.
I want to thank my examiner Benoit Baudry, who helped me define my
thesis’s focus points and scope. Then, I want to thank Northvolt and my
supervisors, Kim Aarnseth and Daniela Attalla, for being supportive and
genuinely interested in my work. Finally, I want to thank my academic
supervisor, Cyrille Artho, who has given me great support and valuable
guidance throughout the whole project.
Contents
1 Introduction 1
1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Hypothesis . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 Purpose and sustainability . . . . . . . . . . . . . . . . . . . 5
1.5 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.6 Research Methodology . . . . . . . . . . . . . . . . . . . . . 6
1.7 Delimitations . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.8 Structure of the thesis . . . . . . . . . . . . . . . . . . . . . . 7
2 Background 9
2.1 Mobile application development . . . . . . . . . . . . . . . . 9
2.1.1 Native applications . . . . . . . . . . . . . . . . . . . 10
2.1.2 Web applications . . . . . . . . . . . . . . . . . . . . 11
2.1.3 Hybrid applications . . . . . . . . . . . . . . . . . . . 12
2.1.4 Interpreted applications . . . . . . . . . . . . . . . . . 12
2.2 Progressive Web Applications . . . . . . . . . . . . . . . . . 13
2.2.1 Service Workers . . . . . . . . . . . . . . . . . . . . 14
2.2.2 Web app manifest . . . . . . . . . . . . . . . . . . . . 16
2.2.3 Application shell . . . . . . . . . . . . . . . . . . . . 16
2.3 Frameworks . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.3.1 Swift & SwiftUI . . . . . . . . . . . . . . . . . . . . 17
2.3.2 React JS . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.3.3 React Native . . . . . . . . . . . . . . . . . . . . . . 17
2.4 PWA feature detection tools . . . . . . . . . . . . . . . . . . 18
2.4.1 Steiner’s PWA feature detector . . . . . . . . . . . . . 19
2.4.2 What Web can do today . . . . . . . . . . . . . . . . 19
2.5 XCode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.5.1 XCTest . . . . . . . . . . . . . . . . . . . . . . . . . 19
viii | Contents
4 Method 27
4.1 Research questions . . . . . . . . . . . . . . . . . . . . . . . 27
4.2 RQ1: Feature support and detection . . . . . . . . . . . . . . 28
4.2.1 Feature support . . . . . . . . . . . . . . . . . . . . . 28
4.2.1.1 Accessibility . . . . . . . . . . . . . . . . . 28
4.2.1.2 Installation and Storage . . . . . . . . . . . 29
4.2.1.3 Display and Screen control . . . . . . . . . 29
4.2.1.4 Background tasks and Notifications . . . . . 30
4.2.1.5 Device hardware and Surroundings . . . . . 30
4.2.2 Feature detection . . . . . . . . . . . . . . . . . . . . 31
4.3 RQ2: QR code scanning . . . . . . . . . . . . . . . . . . . . 32
4.3.1 Requirements . . . . . . . . . . . . . . . . . . . . . . 32
4.3.2 QR code scanning experiment . . . . . . . . . . . . . 32
4.4 RQ3: Performance . . . . . . . . . . . . . . . . . . . . . . . 33
4.4.1 Geolocation experiment . . . . . . . . . . . . . . . . 34
4.4.2 Navigation experiment . . . . . . . . . . . . . . . . . 34
4.4.3 Scrolling experiment . . . . . . . . . . . . . . . . . . 34
4.5 Experimental setup . . . . . . . . . . . . . . . . . . . . . . . 35
4.6 Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.6.1 Scanning correctness . . . . . . . . . . . . . . . . . . 36
4.6.2 Clock monotonic time . . . . . . . . . . . . . . . . . 36
4.6.3 CPU time . . . . . . . . . . . . . . . . . . . . . . . . 36
4.6.4 Memory consumption . . . . . . . . . . . . . . . . . 37
4.6.5 Geolocation accuracy . . . . . . . . . . . . . . . . . . 37
4.7 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Contents | ix
5 Results 43
5.1 RQ1: Feature support . . . . . . . . . . . . . . . . . . . . . . 43
5.1.1 Accessibility . . . . . . . . . . . . . . . . . . . . . . 45
5.1.2 Installation and Storage . . . . . . . . . . . . . . . . . 45
5.1.3 Display and Screen control . . . . . . . . . . . . . . . 46
5.1.4 Background tasks and Notifications . . . . . . . . . . 47
5.1.5 Device hardware and Surroundings . . . . . . . . . . 47
5.1.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . 48
5.2 ANOVA assumptions analysis . . . . . . . . . . . . . . . . . 49
5.3 RQ2: QR code scanning . . . . . . . . . . . . . . . . . . . . 50
5.3.1 Scanning requirements . . . . . . . . . . . . . . . . . 50
5.3.2 Scanning correctness . . . . . . . . . . . . . . . . . . 51
5.3.3 Response time . . . . . . . . . . . . . . . . . . . . . 51
5.3.4 CPU usage . . . . . . . . . . . . . . . . . . . . . . . 52
5.3.5 Memory consumption . . . . . . . . . . . . . . . . . 53
5.3.6 Statistical analysis . . . . . . . . . . . . . . . . . . . 54
5.3.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . 55
5.4 RQ3: Performance . . . . . . . . . . . . . . . . . . . . . . . 56
5.4.1 Response time . . . . . . . . . . . . . . . . . . . . . 56
5.4.2 CPU usage . . . . . . . . . . . . . . . . . . . . . . . 58
5.4.3 Memory consumption . . . . . . . . . . . . . . . . . 61
5.4.4 Geolocation accuracy . . . . . . . . . . . . . . . . . . 65
5.4.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . 67
6 Discussion 69
6.1 RQ1: Feature support . . . . . . . . . . . . . . . . . . . . . . 69
6.2 RQ2: QR code scanning . . . . . . . . . . . . . . . . . . . . 70
6.3 RQ3: Performance . . . . . . . . . . . . . . . . . . . . . . . 71
6.4 Threats to validity . . . . . . . . . . . . . . . . . . . . . . . . 72
x | Contents
References 79
List of Figures
List of Tables
Listings
OS Operating system
UI User Interface
xviii | List of acronyms and abbreviations
Introduction | 1
Chapter 1
Introduction
1.1 Background
When smartphones started to emerge and mobile applications became popular,
there was mainly one technique used for mobile development, the native
approach. Although there were a few attempts to create web-based mobile
applications at the time, they often failed due to inadequate hardware access,
poor user experience, and extensive load times [5]. For instance, web
applications were not capable of accessing the device’s gyroscope or camera,
providing offline support, or sending push notifications [5].
With the increased popularity and accessibility demands on mobile
applications and the increased fragmentation across platforms, platform-
specific development started to become one of the greatest challenges of
mobile application development [4]. This gave rise to cross-platform
application development tools and frameworks, making it possible to develop
one single application compatible with several platforms. An early approach
was hybrid applications, combining native functionality and web technologies
to enable development with web technologies while still having access to
hardware functionality [6]. Another was the interpreted approach, where
source code gets interpreted into native components in a separate run-time
environment [7]. Although these approaches have been popular in mobile
application development recently, especially the interpreted approach, they
still suffer from limitations [1, 6].
Although native-specific features such as offline mode, push notifications,
and background synchronization were for long unthinkable to be supported
by the web, the great advancements in web technology have started to make
this reality [5]. With more widespread support for device-specific hardware
and software Application programming interfaces (APIs), a new kind of
web applications have started to emerge, PWAs. PWAs are an extension of
web applications, with additional features such as offline mode, background
synchronization, and push notifications. As for web applications, PWAs can
be used on any device with a browser, adding another layer to recent cross-
platform approaches. PWAs strive to overcome the weaknesses of former
approaches by providing access to both web and native application features to
get the best of the two worlds [8]. Another advantage with PWA development
is that it only requires developers with knowledge of one programming
language, making it easier to find, hire and manage the development team.
This is particularly important for companies such as Northvolt, where all cost
reductions are crucial since they enable faster development and maintenance
with the same resources and more spending in areas where it matters.
Introduction | 3
1.2 Problem
To investigate the suitability of PWAs for mobile application development, it
is appropriate to consider it in the context of the requirements for a successful
cross-platform framework. For a cross-platform development framework to
be regarded as a valid substitute for native applications, it must have sufficient
support of built-in native features [1, 10, 11]. The importance of this was
shown as early as one and a half-decade ago when developers were trying to
build web-based applications as an alternative for native applications [5].
Another crucial factor is the resource consumption [1, 10]. Mobile devices
are limited in Central Processing Unit (CPU), memory, and battery capacity,
making efficient applications in these aspects an indispensable factor. CPU
and memory usage directly impact the application’s energy consumption and
the device’s ability to run separate processes simultaneously. A long-lasting
battery time and efficient applications in these terms are essential for the user
experience of the device [3, 12] and environmental sustainability. Another
critical metric for the user experience is response times [3].
For the most part, previous research concerning mobile applications and
PWAs only targets the Android platform. A reason for this could be that iOS
is lagging behind Android in PWA feature support. Another reason could be
that the Android profiling experience is better and provide more insightful
data [12]. Although Android accounts for the largest share of the Mobile
Operating System market shares, iOS is a major player reaching above 26 %
of mobile users worldwide [13] and 52 % of mobile users in Sweden [14],
making application support for the iOS platform important. As shown in
previous research, mobile application performance and feature availability
depend heavily on the evaluated framework and the targeted platform and
4 | Introduction
OS [3, 5, 12]. For this reason, assessing available features and performance on
both Android and iOS is essential for the ongoing academic discussion about
PWAs.
Nonetheless, there is a lack of knowledge in CPU and memory
consumption and what native features are available on iOS for PWA. Only one
researcher, Steiner, has evaluated native feature support on iOS [5]. However,
this work only includes 15 features and was conducted in 2018. In addition, the
thesis by Fournier and the work by Biørn-Hansen et al. stand out as the only
studies that evaluate the CPU and memory performance of PWAs [15, 16].
Nevertheless, these research projects only cover evaluations on the Android
platform. Furthermore, work with similar characteristics as this research
project has also been suggested by Fournier [15], Johannsen [17], and Biørn-
Hansen [16].
Finally, Willocx et al. suggested the performance overhead of accessing
device-specific resources from cross-platform tools as another important topic
to investigate [3]. QR code scanning is an interesting feature in that sense since
it requires hardware access to the camera. QR code scanning is also a critical
feature for Northvolt, making it an excellent fit for this work. To gain a better
understanding of these areas and how PWAs stands out compared to other
approaches, this research aims to answer the following:
RQ1 What set of native iOS features are supported for PWAs and React Native
applications?
RQ2 How well is QR code scanning and recognition supported for PWAs and
are available tools as performant as for native iOS applications?
1.3 Hypothesis
The results of previous work indicate that web applications and PWAs
perform slightly better than cross-platform applications such as React Native
applications in terms of performance but are limited in native features support
and performance compared to native Android applications [3, 6, 7, 12, 16,
18, 19]. Although Android and iOS are different platforms, and as Biørn-
Hansen et al. concluded differ significantly in memory consumption and CPU
Introduction | 5
usage [12], it is reasonable to believe that the native iOS application is the
most performant followed by the PWA and the React Native application.
PWAs are probably the most restricted regarding native features support,
followed by the React Native application. Fredrikson’s work showed that React
Native provides comprehensive support for most features on Android [7].
Thus, we believe that the same applies to iOS.
Fransson discovered that camera access was faster on the Android native
application than the PWA [20]. A reasonable scenario is that we achieve a
similar result for native iOS and that the native iOS application is the most
performant in QR code scanning and recognition. In summary, this research
will have the hypotheses:
1.5 Goals
This section presents the goals we strive to achieve with this thesis. The goals
are as follows:
G1 Examine the current support of native features for PWAs and provide a
table describing it.
1.7 Delimitations
Since much work has been done evaluating mobile applications on Android,
this project will not include experiments on the Android platform. This work
will also only include a subset of the native features available, selected after
importance to stay within the scope of a Master’s thesis. Furthermore, while
exterminating native features, features will be classified as not supported if
there does not exist a well-known API which provides an opportunity to use
the feature. This implies that workarounds might exist that enable the feature,
even if it is classified as not supported in this study.
Henceforth, the benchmark and the experimental setup are limited in
numerous ways. A more extensive benchmark would have created more
reliable and comparable results, especially for performance comparison. Due
to time constraints, we only evaluated one cross-platform approach. In
addition, we only evaluate one framework for the PWA. Obviously, including
more frameworks and deeper analysis would deliver more reliable results.
Furthermore, we only examined two different devices. More extensive
experimentation, including various devices of different kinds, might impact
the outcome.
Chapter 2
Background
This chapter introduces the concepts and technologies used in this study. It
covers basic background information about mobile application development,
including native development and different approaches for cross-platform
applications and their differences. Additionally, we discuss important
concepts and cornerstones of PWAs, the frameworks for the benchmark
applications, and tools for experiment automation and profiling on iOS.
interpreted applications. Web applications and PWAs run in the Web browser,
a hybrid application in a combination of web and native components, and
interpreted applications in a self-contained environment [6].
such as the camera, the microphone, and the Global Positioning System (GPS)
of the device [24, 25].
The closeness to the device hardware results in great performance and
the usage of native components a pleasant user experience [6, 17, 24, 26].
However, since the source code is not shareable between platforms, developers
will have to repeat coding, testing, maintenance, and distribution using
different SDKs, frameworks, tools, and programming languages for each
specific platform, leading to high development and maintenance costs [9, 24,
26, 27]. In addition, the wide range of programming languages, tools, SDKs,
and frameworks used sets higher demands on the development team, which
must have platform-specific knowledge [6].
Native Android applications are typically developed in Java or Kotlin using
Android SDK, and native iOS applications are written in Swift or Objective-C
using Xcode.
are only available if they are supported by the development environment [1].
Popular interpreted application frameworks are React Native, Native-
Script, Titanium [7, 24, 31]. React Native is the most commonly used and
did significantly increase the interest for the interpreted approach in mobile
application development [23, 31].
Figure 2.2: This figure illustrates the service worker and how it handles
incoming user requests.
2.3 Frameworks
A native iOS application and an interpreted application in React Native will
serve as the baseline for comparison to the React PWA in this study. Swift
and SwiftUI together offer the most modern way of developing native iOS
applications, motivating their usage. React Native was chosen due to its
popularity, its vicinity to PWAs in web technologies utilization, and promising
Background | 17
results in previous studies [7, 12, 30, 31, 40, 41]. React JS was primarily
chosen due to its vast popularity and similarity with React Native [42]. This
section briefly introduces the frameworks for the benchmark applications.
2.3.2 React JS
React JS is an open-source user interface framework created by Facebook. It
provides developers with tooling to build front-end web applications. React
JS only provides state management and rendering functionality, inferring that
React developers usually need to utilize additional libraries when developing
applications. React JS is currently the most popular framework worldwide for
front-end development [42].
2.5 XCode
Xcode is Apple’s integrated development environment (IDE) used to build
applications for Apple devices. Xcode provides various tools to manage the
entire development workflow, from developing, to testing, optimizing, and
releasing it to the App Store [49]. Xcode provides the testing framework
XCTest and the profiling tool Xcode instruments used for experiments
automation and profiling in this study.
2.5.1 XCTest
XCTest is a testing framework provided by Apple that can be used to create
and run automated unit tests, performance tests, and User Interface (UI) tests
for Xcode projects [50]. XCUITest is the UI testing tool provided by XCTest.
It is a multiprocess testing tool that utilizes a separate test runner process to
drive interactions with the application. Whenever a UI action is performed
in XCUITest, the framework makes sure to synchronize with the application’s
20 | Background
state by checking that the application is idle before proceeding with the next
action [51].
XCTMetric is the protocol used in XCTest for performance measurements.
The protocol defines methods that objects must provide when gathering
metrics during performance tests [52]. XCTest supplies six different metrics
classes adopting the XCTMetric protocol, for which XCTClockMetric is used
in this study [53].
2.6 Summary
As discussed in this section, there exist numerous approaches and frameworks
for mobile applications development today. This study targets PWAs and the
native and the interpreted paradigms. Since we target the iOS platform in
this study, it is sufficient to develop a native iOS application as a reference
for comparison. Having a native application as a baseline is important
since performance-oriented comparison without a baseline is intrinsically
difficult [12]. The interpreted application is developed using React Native and
the PWAs using React JS, because of their wide popularity and similarity. The
similarity between the frameworks ease benchmark development and results
in a better comparison [7, 15]. Another reason for choosing these framework is
that they are widely used within the company, where many web applications
are written in React JS and the current mobile factory application in React
Native. The open-source project Workbox is used to develop the service
worker. Workbox was selected due to its vast popularity and to save time,
since writing custom service workers can be time-consuming [17].
State of the art | 21
Chapter 3
Although PWAs have created an interest in mobile and web development, the
academic involvement is still low [9]. Majchrzak et al. tried to increase the
academic interest with their work analyzing the foundations of PWAs in cross-
platform development [9]. They concluded that it is too early to determine
whether PWAs can replace existing cross-platform development approaches
but emphasized that PWAs can contribute to a richer development experience
and maybe even better apps. Therefore, they urge academia to perform more
work in the field, balancing experimental and qualitative research.
This chapter gives an overview of the most important work related to PWAs
and other cross-platform frameworks. It is divided into four main topics:
feature evaluation, performance, user experience, and code quality. It ends
with a summary, including the key takeaways from this chapter.
3.3 Performance
Several studies have been conducted evaluating the performance of cross-
platform frameworks. This section presents work related to response times
and application size, CPU and memory usage, and energy consumption.
running in the background, but slower if not. Furthermore, they showed that
React Native applications perform well compared to the other cross-platform
applications [30, 31].
Several works strengthen the conclusion of PWAs’ small application
size [24, 58, 59, 61, 62], and their fast application launch time and short first
paint metric compared to native and other cross-platform applications [19, 24,
34, 58, 59, 61, 63]. However, Kerssen states that the launch time is slightly
faster for the native application than the PWA on the iOS platform [61].
In 2017, Fransson performed experiments to compare the response time of
camera and geolocation access for PWAs and native Android applications on
the Android platform [20]. Fransson performed experiments on two devices,
a Huawei Honor 8 and a OnePlus X, and statistically evaluated the result using
a t-test. Fransson concluded that native Android applications have a shorter
response time for accessing the camera than PWAs, whereas the opposite is
true for geolocation [20].
Biørn-Hansen et al. showed that React native applications perform well
compared to other cross-platform approaches when it comes to Time to
completion (TTC) for access to software and hardware APIs on Android, but
not as good as native Android applications [16]. Willocx et al. measured
the response time of in-app navigation and showed that some cross-platform
frameworks, including the interpreted framework Titanium, perform slightly
worse than native applications [3].
3.6 Summary
The largest body of related work focuses on different kinds of performance
criteria were the most recurring are application size, response times, and
resource consumption. Previous work indicates that PWAs are comparable
to and in some criteria, even more performant than native applications [31,
61]. Nevertheless, native applications surpass PWAs in memory and CPU
performance on Android [15]. React Native applications perform well
compared to other cross-platform applications, but are often outperformed by
native applications [15, 16, 31]. For the most part, previous work only targets
the Android platform.
Several studies have evaluated what kind of features that are important
and how their support can be be detected with tools. PWAs and React Native
applications, have adequate feature support on Android, but the feature support
is more limited on iOS [5, 7].
Finally, both PWAs and React Native applications provide a similar user
experience as native applications [7, 66].
Method | 27
Chapter 4
Method
This chapter provides an overview of the research method used in this thesis.
Section 4.1 recalls the research questions and motivates their relevance with
respect to previous work. Section 4.2 introduces the evaluated feature set
and the methodology used for feature detection and support classification.
Section 4.3 focuses on the methodology used to answer RQ2, and Section 4.4
the methodology used to answer RQ3. Section 4.5 presents the experimental
setup. Section 4.6 explains the metrics recorded during the experiments.
Section 4.7 introduces the statistical methods used to analyze the result.
Section 4.8 presents the benchmark artifacts.
RQ1 What set of native iOS features are supported for PWAs and React Native
applications?
RQ2 How well is QR code scanning and recognition supported for PWAs and
are available tools as performant as for native iOS applications?
4.2.1.1 Accessibility
Apple provides several features for their users which customize the appearance
of UI elements on the screen. This thesis tests eight accessibility
features, evaluating the framework’s ability to retrieve the user’s accessibility
preferences on the device.
• Text size — Enables the user to customize the systems default text size
on the screen.
• File access — The ability to access files, documents, images, and videos
on the device.
• Microphone — The ability to access and record audio with the device’s
microphone.
4.3.1 Requirements
The requirements consist of four requirements, supposed to give an insight of
whether PWAs are enough supported for iOS factory scanning applications.
Firstly, support for the symbology types Data matrices, and QR codes are
crucial since they frequently occur in the factory. Secondly, we check for
support of advanced camera features such as the torch and zoom. The
advanced camera capabilities are not mandatory but preferred.
Table 4.1: Feature implementation summary for Apple App Store’s 25 top free
applications in Sweden [68]. The utilization of navigation and scroll views
were manually reviewed by testing the applications. Usage of geolocation was
derived from the applications app integrity section at Apple App Store.
4.6 Metrics
The XCTest class XCTClockMetric’s metric clock monotonic time was used
to record the elapsed time during the experiments. CPU and memory
measurements were collected with the Activity monitor in Xcode instruments.
Xcode instruments is great for profiling but forces the user to extract
36 | Method
the results manually. Thus, CPU and memory data extraction was only
performed for 30 repetitions per device and experiment. In addition to
these metrics, we captured the horizontal geolocation accuracy during the
geolocation experiment and scanning correctness during the QR code scanning
experiment.
The functionality of the modern WebKit API is segregated between the
UIProcess (MobileSafari) and the auxiliary processes: WebContent, Network-
ing, and Storage [55]. Out of these, only WebContent significantly impacts
the performance. Therefore, we include the app-specific WebContent process
for PWA CPU and memory measurements. For the scanning experiment,
we also incorporate the mediaserverd process for memory measurements and
mediaserverd plus applecamerad (iPhone 8) or appleh13camerad (iPhone 13)
for CPU measurements since these processes were highly impacted. Note that
only CPU measurements of the camera processes were included since their
memory impact was negligible.
experiment [70]. The CPU time metric does not include time for when the
CPU is idle or has switched context to execute instructions of a different
process or thread [70]. The formula for the CPU metric is given below, where
ti refers to the time elapsed for one specific CPU. High CPU usage results
in higher battery consumption and could negatively impact other processes
running on the platform and so on the experience of using them [3, 15].
∑
CPUs
ti
i=1
4.7 Analysis
The collected data were evaluated using statistical analysis, where character-
istics of the collected data constituted the basis for the choice of statistical
method. First, we used variance analysis to determine whether there was
a difference in mean or median between the collected data per application.
Then, we performed post-hoc analysis to determine the specific groups that
are significantly different.
38 | Method
The third assumption is fulfilled for all samples, but assumptions 1-2 must
be verified. The normality assumption was confirmed visually by plotting
QQ-plot of the residuals and checking that the residuals follow the 45-degree
line [73]. If the normality assumption holds, we continued by checking the
common variance assumption with Bartlett’s test [73].
If assumption 1 holds but assumption 2, the assumption of homogeneity
of variances is violated, there is an alternative to ANOVA called Welch’s
ANOVA [74]. As for ANOVA, Welch’s ANOVA compares two means to see if
they are equal. Furthermore, we use the Kruskal-Wallis method if assumption
1, the normality assumption, is violated. Kruskal-Wallis is a non-parametric
alternative to ANOVA, without the data normality requirement [75]. In
contrast to ANOVA and Welch’s ANOVA that test the difference between
means, Kruskal-Wallis evaluate the median value [74].
Table 4.3: Overview of the statistical methods used depending on the violated
assumption.
(a) Progressive Web App (b) React Native App (c) Native iOS App
The jsQR1 library has the second smallest size, the smallest number
of dependencies, and the highest number of weekly downloads. It is also
actively maintained. However, jsQR and react-qr-reader2 does not support
data matrices, which is required. The only JS libraries supporting data
matrices are ZXing3 and Html5-XRCode4 , where ZXing is the most popular
and well-used. Thus, we decided to implement the PWA scanner using the
ZXing library.
Only two sufficient React Native libraries was found in the GitHub search,
1
https://github.com/cozmo/jsQR
2
https://github.com/JodusNodus/react-qr-reader
3
https://github.com/zxing-js/library
4
https://github.com/mebjas/html5-qrcode
Method | 41
4.8.2 Geolocation
For the native application, we used the Standard Location service of the Core
Location API. The Standard Location service is a general-purpose solution
for tracking the user’s location and is the most accurate and immediate API
location provider out of Core Location’s three services [78]. The disadvantage
of using this API is the high power consumption compared to the other location
services [78]. Despite the high power consumption, there is a trade-off with
the accuracy, where high accuracy was determined as most important.
For the PWA artifact, geolocation was implemented with the Geolocation
API. The third-party library React Native Geolocation, an extension of the
web-based Geolocation API, was used to retrieve the device’s geolocation
in the React Native artifact [79]. For location tracking in the React Native
application, we set the flag enableHighAccuracy, meaning that the API
provides the location using the GPS. If the flag is not set, the API only utilize
the Wi-Fi [79].
4.8.3 Navigation
The artifacts utilize two different navigation components bottom Navigation
and stack Navigation. For the native iOS artifact, bottom Navigation was
implemented with the TabView component [80], and stack navigation with
the NavigationView component [81].
Navigation in the React Native artifact was implemented using the React
Navigation library [82]. Bottom Navigation was implemented with the Bottom
Tabs Navigator component, and Stack navigation was implemented with the
Stack Navigator component.
Even though open-source libraries exist for native-like Navigation in Web
applications and PWAs, they are simple to implement, which is why we
decided to implement them from scratch. The custom-built components for
the PWA mimic the appearance of the native components.
5
https://github.com/moaazsidat/react-native-qrcode-scanner
6
https://github.com/react-native-camera/react-native-camera
42 | Method
Chapter 5
Results
In this chapter, we present the results and analyze them. Section 5.1 covers
RQ1 and contains the results of the feature evaluation. Section 5.2 provides
an overview of the ANOVA assumption analysis. Section 5.3 focuses on RQ2
and includes PWAs’ scanning suitability and performance compared to React
Native and native iOS. Section 5.4 presents the results and analysis of the run-
time experiments associated with RQ3.
Table 5.1: Feature support for PWAs and React Native applications. Supported
features are notated with a check mark (3), unsupported with a cross (7), and
partly supported features with a triangle (△).
Results | 45
5.1.1 Accessibility
PWAs can access the user preferred language by calling the navigator’s
language or languages properties.1 However, PWAs can only access the
primary language, even though several languages are specified. PWAs cannot
access the device’s reduce transparency setting. The functionality is provided
by the CSS setting prefers-reduced-transparency2 , but it is not compatible with
any browser yet. All other accessibility features: bold text and text size3 ,
contrast4 , dark mode5 , inverted colors6 , and reduce motions7 are supported
and can be adapted with CSS rules.
React Native applications access the device’s dark mode setting via
the Appearance module8 and the bold text setting, inverted colors setting,
reduce motions setting, and reduce transparency via the AccessibilityInfo
API9 . React Native utilizes the iOS platform-specific DynamicColorIOS API10
to customize colors when the user’s increased contrast setting is enabled.
Automatic font scaling is enabled by default on React Native Text elements
but can be turned off with the allowFontScaling property11 . React Native
applications can access the preferred languages via React Native Localize12 .
can detect all life cycle state transitions, except for application start-up and
termination.
React Native applications can access the application state via the AppState
API25 . React Native applications cannot, as for PWAs, detect start-up and
termination transitions. The library React Native Orientation Locker26
provides orientation lock, and the launch screens are, as for native iOS
applications, added in Xcode. Fullscreen mode is provided by the Status Bar
API27 . By default, the theme color is translucent on iOS devices and cannot
be changed directly through the Status Bar API. Nevertheless, embedding the
status bar component inside another results in the same appearance.
5.1.6 Summary
In summary, PWA supports 24 of the 33 evaluated features, where 14 are
fully supported, ten partly supported and nine unsupported. Three crucial
native features and key principles behind PWAs are installability, network
independence and re-engageability. Of these, only network independence is
fully supported, and installability partly supported by PWAs.
38
https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent
39
https://developer.mozilla.org/docs/Web/API/DeviceOrientationEvent
40
https://developer.mozilla.org/docs/Web/API/Geolocation_API
41
https://developer.mozilla.org/docs/Web/API/Sensor_APIs
42
https://developer.mozilla.org/docs/Web/API/Web_Bluetooth_API
43
https://developer.mozilla.org/docs/Web/API/Web_NFC_API
44
https://developer.mozilla.org/docs/Web/API/Vibration_API
45
https://github.com/revtel/react-native-nfc-manager
46
https://github.com/dotintent/react-native-ble-plx
47
https://reactnative.dev/docs/vibration
48
https://github.com/react-native-sensors/react-native-sensors
49
https://github.com/react-native-geolocation/react-native-geolocation
50
https://github.com/react-native-camera/react-native-camera
51
https://github.com/hyochan/react-native-audio-recorder-player
52
https://github.com/react-native-ar/react-native-arkit
53
https://github.com/viromedia/viro
Results | 49
React Native fully supports all features but two, which are partly supported.
The core library provides 21 of these features, whereas third-party libraries
provide the remaining 12.
Table 5.2: Normality and variance analysis overview for the metrics.
Figure 5.1 illustrates two examples for when the collected data passed
and failed the normality test, and Table 5.2 summarizes the analysis results.
Bartlett’s test results are located in Appendix B.
Table 5.4: Percentage of correct scanning attempts per framework and code.
Figure 5.2: Box plot describing the clock monotonic time in seconds (s) per
device for the scanning experiment.
Figure 5.3: Box plot describing the CPU time in seconds (s) per device for the
scanning experiment.
Results | 53
Figure 5.4: Box plot describing the RAM in mebibytes (MiB) per device for
the scanning experiment.
54 | Results
Figure 5.5: Box plot describing the ComputedRAM in mebibytes (MiB) per
device for the scanning experiment.
Table 5.5: The scanning experiment results per metric and framework. The
Mean columns display the means for each application, over 100 runs for the
clock monotonic time metric, and over 30 runs for the other metrics. The
Welch’s ANOVA column, the p-value from the Welch’s ANOVA analysis, and
the Rank columns ranks the frameworks from 1 (best) to 3 (worst).
5.3.7 Summary
PWAs fulfill the mandatory requirements for QR code scanning, although
they suffer from access to advanced camera features on iOS. In addition, the
PWA outperformed the other frameworks in CPU and memory utilization
but performed worse in scanning correctness and clock monotonic time.
Table 5.13 summarizes the frameworks’ performance ranks from the run-time
experiments.
(a) Geolocation
Results | 57
(b) Navigation
(c) Scrolling
Figure 5.6: Box plots describing the clock monotonic time in seconds (s) per
device and experiment.
58 | Results
Table 5.7: Clock monotonic time results per experiment and framework. The
Mean columns display the means for each application over 100 runs, the
Welch’s ANOVA column, the p-value from the Welch’s ANOVA analysis, and
the Rank columns ranks the frameworks from 1 (best) to 3 (worst).
(a) Geolocation
(b) Navigation
60 | Results
(c) Scrolling
Figure 5.7: Box plots describing the CPU time in seconds (s) per device and
experiment.
Table 5.8: CPU time results per experiment and framework. The Mean
columns display the means for each application over 30 runs, the Welch’s
ANOVA column, the p-value from the Welch’s ANOVA analysis, and the Rank
columns ranks the frameworks from 1 (best) to 3 (worst).
Results | 61
(a) Geolocation
62 | Results
(b) Navigation
(c) Scrolling
Figure 5.8: Box plots describing the RAM used in mebibytes (MiB) per device
and experiment.
Table 5.9: RAM results per experiment and framework. The Mean columns
display the means for each application over 30 runs, the Welch’s ANOVA
column, the p-value from the Welch’s ANOVA analysis, and the Rank columns
ranks the frameworks from 1 (best) to 3 (worst).
(a) Geolocation
64 | Results
(b) Navigation
(c) Scrolling
Figure 5.9: Box plots describing the ComputedRAM in mebibytes (MiB) per
device and experiment.
We can observe that the React Native application has a very low
ComputedRAM for all experiments. The same applies to native iOS in
geolocation and navigation, but the results are worse for scrolling. The PWA
Results | 65
Table 5.10: ComputedRAM results per experiment and framework. The Mean
columns display the means for each application over 30 runs, the Welch’s
ANOVA column, the p-value from the Welch’s ANOVA analysis, and the Rank
columns ranks the frameworks from 1 (best) to 3 (worst).
(a) Location 1
(b) Location 2
Figure 5.10: Box plots describing the horizontal accuracy achieved in meters
(m) per device and location.
Results | 67
Table 5.11: Horizontal min, mean and max accuracy achieved in meters (m).
5.4.5 Summary
Surprisingly, React Native was the most performant framework, tightly
followed by native iOS. The PWA performed worse overall in all metrics but
clock monotonic time and geolocation accuracy. Table 5.13 summarizes the
frameworks’ performance ranks from the run-time experiments.
68 | Results
Chapter 6
Discussion
This chapter is divided into four parts and discusses the results in a broader
context. The first concerns the results of the RQ1 regarding feature support,
the second covers RQ2, the suitability of using PWA as factory scanning
applications, and the third considers the run-time performance related to RQ3.
Finally, the fourth part discusses the validity of the results.
for all the most crucial native features, enabling PWAs to be classified as a
valid substitute for native development. One reason for Apple to refuse wider
PWA support is that Apple’s application ecosystem may suffer if there exist
alternative ways to publish and download iOS applications [9].
React Native provides support for most features and is more reliable than
PWA in that sense. However, one significant problem with React Native is
the dependency on third-party libraries. The maintenance of these libraries
might stop or be substituted for new ones. For instance, the React Native
Camera library was the go-to library for camera implementations in React
Native at the beginning of this study. As for today, the library is deprecated
in favor for React Native Vision Camera [86]. Substituting libraries is,
in one sense, great since it comes with benefits such as improved API,
performance improvements, improved stability, and new features adapted to
modern devices. However, it forces project and application maintainers to
migrate to new APIs, which depending on the differences, can be both costly
and time-consuming. Thus, the strength of the large React Native community
providing wide feature support is also a great weakness since maintenance
over time is not guaranteed.
likely explanation for slow native response times could be derived from the
components’ default animations. For instance, the transition animations for
the native navigation components. These animations could have an impact on
application idling time, which directly delays succeeding UI interactions in
XCUITest. That would also explain why the navigation experiment with the
largest number of animation transitions had the most significant difference in
response times.
Remarkable is the high ComputedRAM measurements for the native iOS
application, where especially the scrolling experiment stands out. The high
scrolling ComputedRAM is probably due to the use of the native LazyGrid
component, which seems to have a significant memory impact. The images
have a total size of 39MB, so a mean application memory peak above 230
MiB is substantial, indicating that native applications and components are not
always the most performant. The lazy loading is probably also the reason for
the high native CPU utilization for the scrolling experiment. Due to the high
ComputedRAM and relatively low RAM measurements for the native iOS
application, a reasonable explanation is that the native run-time environment
does not load the complete application into memory on start-up but rather lazy
loads components while interacting with the application.
measure method does not measure the correct interval for CPU and memory
measurements. The measured CPU and memory interval begins at application
start-up rather than when the block starts. This infers that physical memory
measurement reports the memory utilization at the end of the block rather
than the ComputedRAM as stated in the documentation [89]. It also implies
including experiment setup overhead for CPU measurements, like starting the
application and navigating to the correct view. Another problem with XCTest
is that the memory peak measurement does not work correctly and returns 0
independently of the experiment or application tested.
Another limitation of XCTest is the inability to profile other processes
than the primary application process. This is problematic since the
applications in some scenarios significantly impact other processes’ resource
consumption—for instance, the scanning experiment had a significant impact
on the mediaserverd process. Most importantly, mediaserverd was affected
differently depending on the application tested, so including the overhead
from significantly impacted processes is crucial for a trustworthy result. The
good part is that one can use Xcode instruments instead to solve both of
these issues. Xcode instruments have been successfully used in isolation
in previous research profiling cross-platform and native applications on iOS
devices [3, 12]. However, one limitation of using Xcode instruments is that the
user must manually extract the values from the timeline, which is very time-
consuming and limits the number of feasible repetitions. Another is that the
measurements are given in second intervals, meaning that the captured period
could be shorter than the interval itself. We solved this problem by padding the
experiments with a couple of seconds in the idle state while measuring CPU
and memory usage, resulting in a much more accurate result. Nevertheless, it
is vital to be aware of this for future studies. Especially when profiling short
and isolated experiments.
74 | Discussion
Conclusions and Future work | 75
Chapter 7
This chapter concludes our study about Progressive Web Applications (PWAs)
on the iOS platform. Firstly, we summarize the conclusions drawn in this
study. Then, we suggest possible future research related to PWAs.
7.1 Conclusions
This thesis provides an overview of PWAs’ feature support, suitability for QR
code scanning, and performance by evaluating 33 features, and measuring
response times, CPU usage, and memory utilization during four different
experiments. The feature evaluation covers important application features
crucial for mobile applications in general and Northvolt in specific. The
performance evaluation includes important metrics which impact the user
experience and the device’s energy consumption.
Many native features are supported for PWAs, and the support continues to
grow. However, the missing support for crucial native features makes PWAs
insufficient for more advanced applications with higher demands, for instance,
applications requiring support for push notifications, background tasks, and
integration with specific hardware. In addition, we are not sure whether iOS
will ever support these features. Although the requirements for an application
are relatively low in the beginning, it could be devastating to choose the
PWA approach since we generally don’t know if more advanced features are
required later on. Nonetheless, PWAs are rigorous enough for simple iOS
use cases, and their substantial advantages make them well worth considering
when requirements are met.
This work shows that PWAs are suitable for QR code scanning. PWAs
offer comprehensive support for different symbology types and perform better
76 | Conclusions and Future work
in CPU and memory utilization than native iOS and React Native applications.
The downsides with PWAs are the slow response times, the slightly worse
scanning correctness, and the missing support for advanced camera features.
In general, native iOS performed best in memory and CPU utilization,
while React Native performed best in response times. Note that the response
time results should be interpreted with care, as discussed in Section 6.4.
Moreover, suppose more severe conditions affect the accuracy of the scan.
In that case, we suggest investigating whether advanced camera features such
as the torch and zoom can maintain the performance.
Finally, we suggest extending the geolocation experiment. This thesis
performs geolocation accuracy testing on a microscopic scale. More extensive
experimentation, including updating frequency, movement, and accuracy over
a more comprehensive set of times, would amplify the conclusions drawn in
this study.
78 | Conclusions and Future work
References | 79
References
[33] MDN Web Docs. (2021) Service Worker API. Accessed: 2021-09-
17. [Online]. Available: https://developer.mozilla.org/en-US/docs/Web/
API/Service_Worker_API
[36] MDN Web Docs. (2021) Web app manifests. Accessed: 2021-
09-17. [Online]. Available: https://developer.mozilla.org/en-US/docs/
Web/Manifest
[47] Adam Bar. What Web Can Do. Accessed: 2021-09-27. [Online].
Available: https://github.com/NOtherDev/whatwebcando
[50] Apple Inc. XCTest — Create and run unit tests, performance tests,
and UI tests for your Xcode project. Accessed: 2021-12-14. [Online].
Available: https://developer.apple.com/documentation/xctest
[85] WebKit Bugzilla. Bug 182566: Feature Request: Add support for the
ServiceWorkerRegistration’s PushManager interface. Accessed: 2022-
01-31. [Online]. Available: https://bugs.webkit.org/show_bug.cgi?id=
182566
Appendix A
Table A.1: A table describing the feature implementation status for Apple
App Store’s top 25 free applications in Sweden. The feature are notated with
a check mark (3) if the application implements it and with a cross (7) if not.
92 | Appendix B: Bartlett’s test results
Appendix B
Table B.1: Bartlett’s p-values per device, experiment and metric. Entries are
notated with a hyphen (—) if the metric is not measured in the experiment, or
a cross (7) if the all collected values are equal.
TRITA – EECS-EX-2022:66
www.kth.se