Mobile Apps Engineering Development Security
Mobile Apps Engineering Development Security
Edited by
Ghita Kouadri Mostefaoui
Faisal Tariq
CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742
This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been
made to publish reliable data and information, but the author and publisher cannot assume responsibility for the
validity of all materials or the consequences of their use. The authors and publishers have attempted to trace the
copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to
publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let
us know so we may rectify in any future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or
utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including pho-
tocopying, microfilming, and recording, or in any information storage or retrieval system, without written permission
from the publishers.
For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://
www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA
01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for a variety of users.
For organizations that have been granted a photocopy license by the CCC, a separate system of payment has been
arranged.
Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for
identification and explanation without intent to infringe.
Visit the Taylor & Francis Web site at
http://www.taylorandfrancis.com
and the CRC Press Web site at
http://www.crcpress.com
Contents
Preface, vii
Acknowledgments, ix
Editors, xi
Contributors, xiii
INDEX, 139
v
Preface
M obile computing has changed the way we learn, interact with online services, and
manage information. The popularity of handheld devices among people of all ages
and cultures has increased the demand for highly interactive and user-friendly mobile apps.
The multitude of sensors available in mobile devices such as GPS, ambient light sensing,
and accelerometers have broadened the use of mobile apps in various application domains.
Mobile apps vary widely, from weather forecasting and managing a patient’s health to
providing online education, among many others.
Both students and lecturers of software engineering with a particular focus on mobile
app development struggle to find a self-contained guide on how to follow the development
life cycle of a mobile app project. In the great majority of these projects, the process
generally follows a traditional software development life cycle—namely, setting up a set of
requirements and then following an incremental development of the mobile app up to the
achievement of acceptable functionality and design. A mobile app is, however, very different
from a desktop application. For instance, mobile apps are expected to run on multiple
mobile operating systems, various screen sizes, and diverse technologies. Testing of mobile
apps is therefore different from that of desktop applications. Additionally, mobile apps
differ in their context of use and may need to take a number of factors into consideration
including internet connection availability and speed, computational complexity, memory
requirements, battery status, and accessibility features. These factors affect the software life
cycle of a mobile app project and therefore more suitable architectures, design patterns,
and testing approaches are needed. In practice, students as well as developers use their
experience in desktop application development and customize the methodologies and tools
to fit the particularities of a mobile app. We believe that a more structured approach can
supplant this ad hoc one.
The objective of this edited book is to gather best practices in the development and
management of mobile apps projects. We aim at providing software engineering lecturers,
students, and researchers of mobile computing a starting point for developing successful
mobile apps. To achieve these objectives, we emphasize the essential concepts such as app
design, testing, and security. This has been done with the aim of producing a compact yet self-
contained book to stimulate further research interest in the topic. We believe our effort can
make mobile apps engineering an independent discipline inspired by traditional software
engineering, but taking into account the new challenges posed by mobile computing.
vii
Acknowledgments
W e would like to thank Dr. Mitul Shukla for his support in the early stages of the
current project.
ix
Editors
Faisal Tariq is a Senior Lecturer in the School of Engineering at the University of Glasgow,
UK. Prior to this, he worked at Queen Mary University of London and the University of
Bedfordshire. He is also serving as editor of Journal of Networks and Computer Applications.
His research interests include future wireless networks, technologies for smart cities, and
mobile computing and communications.
xi
Contributors
xiii
xiv ◾ Contributors
An Introduction to
Mobile Device Security
António Lima, Pedro Borges, Bruno Sousa,
Paulo Simões, and Tiago Cruz
CONTENTS
1.1 Introduction 2
1.2 Security Risks and Open Challenges 3
1.2.1 Evolution of Mobile Device Complexity 3
1.2.2 Information Risks 4
1.2.3 Threat Taxonomy 6
1.2.4 Case Studies on Security Threats in Mobile Devices 7
1.3 Fundamental Concepts 8
1.3.1 Device Security and Application Security 8
1.3.2 Consumer vs. Corporate Environments 10
1.3.3 Stakeholders 11
1.3.4 Mobile Device and Application Management 12
1.3.5 Security Life Cycle for Mobile Devices 13
1.3.5.1 Prevention 13
1.3.5.2 Monitoring 15
1.3.5.3 Mitigation 16
1.3.5.4 Analysis and Comparison 17
1.4 Mobile Device and Application Management 19
1.4.1 Remote Deployment of Security Policies 20
1.4.2 Dedicated Application Stores 20
1.4.3 Remote Device Control 21
1.4.4 Remote Application Deployment 21
1.5 Security Hardening and Preventive Techniques 21
1.5.1 Application Development Aspects 21
1.5.1.1 Data Protection 22
1.5.1.2 Resource Usage 22
1
2 ◾ Mobile Apps Engineering
1.1 INTRODUCTION
This chapter provides a state-of-the-art overview regarding available solutions and best
practices for mobile device and mobile application security. It provides a broad perspective
of the security aspects involved in mobile applications, encompassing the whole ecosystem
(user, operator, operating system, mobile application, and user and application data). Besides
providing guidelines and best practices for the development of secure mobile applications,
it also includes information on how to apply such solutions in Android and iOS mobile
operating systems.
This chapter includes several techniques that can be applied by different players,
including application developers (to design and develop secure mobile applications) and
administrators of corporate systems (to enforce security policies on mobile devices). The
myriad of uses for mobile devices raises security threats that require solutions involving the
full chain: device manufactures (e.g., Samsung), services providers (e.g., Google with Play
Store), applications developers, and consumers (end-users). As such, a broad perspective is
required encompassing the design and development of secure mobile applications, including
selection of appropriate platforms (operating systems, mobile devices, telco support, mobile
device management frameworks), best practices for developing secure mobile applications,
and a clear understanding of the different stakeholders’ roles in provisioning secure
mobile applications. For instance, consumers need to understand the risks associated with
different uses of their mobile device(s), and corporations need to provide adequate security
mechanisms for their devices or for the devices owned by consumers but employed for
professional activities—in line with the Bring Your Own Device (BYOD) paradigm, which
extends the possibilities of mobile device use even in mission-critical scenarios [33], but
leads to issues regarding the management of security by corporations.
Several security approaches can be pursued to prevent attacks (e.g., installation
of malware), to monitor the behavior of applications and use of mobile devices (e.g.,
An Introduction to Mobile Device Security ◾ 3
applications sending frequent data to remote sites without user permission) and to mitigate
potential threats (e.g., malware accessing personal data). In particular, the Mobile Device
and Application Management (MDAM) frameworks (e.g., Samsung Know, Android for
Work) are essential tools for corporate environments, to enforce security policies.
Release Date August 16, 1994 June 29, 2007 Sep. 19, 2014 Nov. 3, 2017
Dimensions 200 × 64 × 38 mm 115 × 61 × 11.6 mm 138.1 × 67 × 6.9 mm 143.6 × 70.9 × 7.7 mm
Weight 510 g 135 g 129 g 174 g
CPU 16-bit, 16 MHz, x86-compatible 32-bit, 412–620 MHz, ARM 64-bit, 1.4 GHz dual-core, ARM 2.39 GHz hexa-core 64-bit
GPU None PowerVR MBX Lite 3D GPU PowerVR Series 6 GX6450 (4-core) Apple GPU (3-core)
Memory 1 MB 128 MB 1 GB LPDDR3 3 GB LPDDR4X
Storage 1 MB 4, 8, or 16 GB 16, 64, or 128 GB 64 or 256 GB
Battery 7.5 V NiCad 3.7 V 1400 mAh Lithium-ion 3.82 V 6.91 Wh (1,810 mAh) 3.81 V 10.35 Wh (2716 mAh)
Lithium-ion Lithium-ion
Data Inputs Microphone, touchscreen with Multitouch touchscreen, Multitouch touchscreen, microphone, Multitouch touchscreen,
stylus 3-axis accelerometer, gyroscope, accelerometer, digital microphone, gyroscope,
Proximity sensor, Ambient compass, iBeacon, proximity sensor, accelerometer, digital compass,
light sensor, Microphone ambient light, fingerprint, barometer iBeacon, proximity, ambient
light, fingerprint, barometer,
face ID
Display 4.5 in × 1.4 in, 160 px × 293 px 3.5 in diagonal, 320 × 480 px 4.7 in diagonal, 1334 × 750 px 5.8 in diagonal, 2436 × 1125 px
monochrome backlit LCD resolution at 163 ppi, 2:3 resolution at 326 ppi, LED-backlit IPS resolution at 458 ppi, Super
aspect ratio, 18-bit (262, LCD, 16:9 aspect ratio Retina HD: AMOLED, 19.5:9
144-color) LCD aspect ratio
Camera None Rear: 2 MP Rear: 8 MP, 1080p HD video recording, Rear: 12 MP, quad-LED dual-tone
slow-motion video, panorama flash, slow-motion video,
Front: 1.2 MP, 720p video recording panorama, face recognition,
1080p and 4K video recording
Front: 7 MP, 1080p HD video, face
detection
Connectivity 2400-bps Hayes-compatible Quad-band GSM/GPRS/ UMTS HSPA + DC-HSDPA, CDMA LTE, TD-LTE, UMTS, HSPA+,
modem, 9600-bps Group 3 EDGE, Wi-Fi (802.11 b/g), EV-DO Rev. A and Rev. B, GSM/ DC-HSDPA, GSM/EDGE,
send-and-receive fax, I/O Bluetooth 2.0 EDGE, Wi-Fi, Bluetooth 4.2, NFC, Wi-Fi, Bluetooth 5.0, NFC, GPS,
connection port, PCMCIA type 2 GPS & GLONASS GLONASS, Galileo & QZSS
An Introduction to Mobile Device Security ◾ 5
6 ◾ Mobile Apps Engineering
location on social networks, users expose themselves to attackers that may want to harm
them physically or benefit from their being in a specific location allowing them to engage
in burglary, robbery, or theft.
While risky behaviors by end-users may to some extent only affect themselves, in
corporate environments the consequences might affect working teams and organizations.
As such, these attitudes and behaviors are of even higher importance in such environments.
By having a security leak and allowing any sensitive information to fall onto the hands of
attackers, whole work teams can be disrupted—resulting in elevated costs for the company.
For instance, a company devoted to fraud detection in credit card transactions might simply
lose its customers and never recover their established reputation.
Additionally, because of the attachment employees have to their personal mobile devices,
organizations are pressured to allow BYOD approaches. While this boosts productivity
and employee satisfaction [22], it also poses serious security risks to organizations. In the
corporate environment, it has been found that either enabling security features by default
on the mobile devices or educating users toward engaging in security-enforcing practices
can enhance security in the enterprise environment [13,29,32].
Social engineering. Users are manipulated to install or run malicious code unwittingly.
This is done in several ways: application repackaging, where malicious code is included
in a legitimate application; fake installers that mimic known application installers;
malicious updates, where a legitimate application is released, but afterwards malicious
code is deployed via updates; and drive-by download, where the user browses a web
page that automatically downloads malicious code.
SMS/MMS. In this type of attack, flaws in the design of the SMS architecture are exploited
and can be used to deliver malicious code or to maintain communication with the
attacker. The malicious code in SMS/MMS messages can make the device disconnect
from the network, terminate calls, reboot, and crash [27].
Bluetooth. Attack by this route exploits this form of radio communication to spread
malicious code from one device to another [31]. A compromised device can pair itself
with other devices using default passwords, and then send copies of malicious code
to the target device.
Internet access. Devices can connect to the internet using several technologies such as
Wi-Fi or 3G/4G. This enables them to use services such as email, social networks,
or web browsing, but also makes them subject to the same threats as conventional
An Introduction to Mobile Device Security ◾ 7
personal computers. Furthermore, the devices are switched on most of the time, which
combined with a constant internet connection increases the probability of an attack.
USB propagation. This sort of attack exploits the ability for application installation via
a data cable. For instance on Android devices, by using the adb shell, the permission
system can be bypassed, making it possible for a malicious application to be installed
with access to all the permissions. Furthermore, there is some malware that infects
Windows machines and installs adb command line tools that propagate malicious
software to the device through USB when it is connected [37].
Near-field communication (NFC). This kind of attack exploits NFC, which can be used in
a drive-by type of attack to force the Android device to browse a website that executes
malicious code on the device. Furthermore, an Android device with an NFC-capable
malware may interact with contactless payment cards in the vicinity and perform
malignant transactions [47].
Despite the existence of those case studies and other reported incidents, it should be noted
that the number of mobile security breaches documented in security reports is still quite
low compared to the number of occurrences [40]. Indeed, a high percentage of IT security
professionals state that it has become harder to guarantee the security of mobile devices. The
attacks range from malware to key logging, credential theft, and phishing attacks.
Process
Dalvik or ART VM
Application
Activity
Service
Content Provider
Broadcast Receiver
as pictured in Figure 1.1. Each instance runs with a unique UNIX user identity, so that
applications are isolated in the Linux platform subsystem and have their own space in the
file system to write private data. This design is enforced at the kernel level by discretionary
access control (DAC) and prevents applications and services from disrupting each other.
Furthermore, Security Enhanced Android (SEAndroid) is a port of Security Enhanced
Linux (SELinux), a Linux kernel security module that supports access control policies such
as mandatory access control (MAC) [44]. It was introduced in Android 4.2, in a permissive
configuration, and from Android 4.4 onward it is present in an enforcing configuration.
There are four key components of Android applications that are important for
understanding the behavior of applications and the security architecture of this OS:
Activities represent the way the user interacts with the application. Each different screen
of the application is defined by a different independent activity, even though they work
together to provide a consistent user experience. Activities are launched using intents
and can be started by a different application, if it is configured as allowed.
Services are components without any type of user interface that perform long-term
background tasks or work for remote processes. Services are launched using intents
and other components. For instance, activities can start services to do some work or
bind to them for interaction.
Content providers manage shared sets of data for access from within the application or
between different applications. The data can be stored in the file system, in SQLite
databases, in the web, or in any other persistent storage. The content provider enables
the applications to query or even modify the data if the configured permissions allow
it. Content providers are accessed through the application-defined Uniform Resource
Identifiers (URIs).
Broadcast receivers are components without a user interface that listen to system-wide
broadcast announcements that perform minimal amounts of work or launch services.
Broadcasts can be initiated by the system or by application-defined events. For
example, they can answer to system events like BATTERY_LOW, BOOT_COMPLETED
or SCREEN_ON.
Intents work as the main vehicles of intercomponent communication (ICC), since
applications are isolated in their own sandbox. Intents are abstract representations of
actions to be performed and can be used to launch activities and to communicate with
components of the same application such as broadcast receivers and services. This is
performed through the binder interprocess communication (IPC), an IPC framework.
ICC is mediated by the Android middleware and obeys the permissions established in
the manifest file. It is the developers’ responsibility to specify the required permissions in
the manifest file. A component protected by a set of permissions can only be accessed by
other components to which access has been granted.
In the Android OS the sensitive hardware components (e.g., telephony, camera, network)
are protected behind a permission model to avoid unauthorized access that could interfere
10 ◾ Mobile Apps Engineering
with the system performance and the user experience. Therefore, each application that
wants to access a particular protected part of the system must require such permission
in the manifest. During the installation, the system verifies the authorities that signed
the application’s certificates and can also inquire of the user whether to allow or deny
permission. If such permission is granted the application is able to make use of the protected
resources. If the permission is not granted the application will work but the access to the
denied resources will not work and no notifications will be shown to the user. Permissions
can be grouped into four types, according to the risk associated with granting access [3]:
1. Normal, the default low-risk permission that gives access to application-level features
with minimal risk to the system, applications, or user. It is automatically granted by
the system without the user’s approval.
2. Dangerous, a high-risk permission that enables the application to control the device
or to access private data. The system does not automatically grant it to the requesting
application. Instead, the dangerous permissions are presented to the user for approval.
3. Signed, a permission that is granted by the system to an application that has the
same certificate as the application that declared the permission. If the certificates
match, the permission is automatically granted by the system.
4. Signature Or System, a permission that is granted by the system only to
applications that are part of the Android system image or to applications with the
same certificate as the declarer. This permission is used only on special situations
where multiple vendors have applications that need to share resources explicitly while
being built together.
Despite all these features aiming to protect applications and their data from the rest
of the device, attackers still find ways to interfere with the data. In this sense, for the
purpose of adding an extra layer of security, trusted execution environments (TEE) can
be employed (further details are described in Section 1.5.7). TEEs can be used to perform
critical operations that cannot be hijacked or have their data modified by external parties.
For instance, specific ARM processors with the TrustZone [7] technology have dedicated
hardware functionality to perform these sensitive operations. This allows vendors to develop
applications that have enhanced security features backed by hardware isolation.
and disaster relief (PPDR), the security requirements concern the leakage of critical mission
information, the location of the agents in the field, and attacks on the device that make it
unusable and unable to perform its function [33].
When using paradigms such as the already mentioned Bring Your Own Device (BYOD),
single devices may need to support multiple profiles. BYOD schemes can be classified
regarding device ownership and enabling model, as summarized in Table 1.2. The different
types of BYOD schemes available for enterprise usage introduce distinct mobile device
management (MDM) policies, which define admissible devices and the type of controls
held over them (accessible data, applications, and functionalities). Recently, large-scale
companies have begun to move from the COCE scheme to more BYOD friendly alternatives,
such as COPE and POCE [1].
General concerns relating to the limited battery life inherent in mobile devices apply
to both consumer and corporate environments. Mobile devices’ compactness also poses
concerns when it comes to cooling or increasing storage space. Another concern, often
treated separately, is the risk of misplacement or theft of mobile devices—which allow
completely different suites of attacks or paths to the data stored in the device.
1.3.3 Stakeholders
Figure 1.2 provides a simplified view of the stakeholders of mobile device ecosystems. For
sake of simplicity some relationships have been omitted (e.g., relations between service
providers and developers, or between consumers and corporations).
Several stakeholders can be identified. Telecommunications and network operators
provide network connectivity to mobile devices, often having contractual relationships with
the consumer or corporations. Device vendors manufacture and provide devices and are
responsible for warranty processes and firmware updates. Device vendors may be interested
in adding new security hardening features to their devices to attract more customers, either
by customizing the OS or by adding extra hardware security layers. Service providers provide
services to the users or corporations and may require specific applications in the mobile
device (take the example of Netflix or others). The operating system’s developers, such as
Google or Android are responsible for building, maintaining, and supporting the operating
system, releasing regular updates. Such companies also provide a plethora of services that
are managed through specific platforms like the official application stores. Indeed, such
stores are crucial for spreading updates of applications. OS developers obviously, are always
striving to improve the quality of their product, which implies improving the security. The
cost of security flaws in the OS is a reduction of user trust in the OS. Developers are also
12 ◾ Mobile Apps Engineering
important key players in this ecosystem, by developing applications and releasing them
in the dedicated application stores. All of these stakeholders take part in shaping how the
ecosystem is maintained and developed.
From a user perspective, a secure mobile device means that the user can use it in a more
relaxed way which will improve the relationship with the given device or OS. On the other
hand, corporations can manage their own application stores to enforce security policies
in their own devices, or to manage to some extent the applications that run on personal
devices (e.g., BYOD devices as described in Section 1.3.2).
is enhanced by assuring that all the accesses to sensitive information are monitored and
evidence is collected regarding unauthorized disclosure of information or other kinds of
attacks.
Further details on available MDAM solutions can be found on Section 1.4.
1. Prevention, which mainly focuses on what can be avoided or stopped before it becomes
a threat or compromises a device.
2. Monitoring and detection, which are focused on the constant and methodical analysis
of device and application behaviors.
3. Reaction and/or mitigation, which are concerned with containing or stopping a threat,
even if it has already caused damage.
The guidelines provided by NIST for Intrusion Detection and Prevention [45] fit within
this context. The following sections detail the most common prevention, monitoring, and
mitigation methods found in mobile devices along with their respective advantages and
disadvantages.
1.3.5.1 Prevention
The preventive methods are gaining more emphasis for providing data security on mobile
devices, when compared with monitoring or detection approaches. Prevention is the first
phase of the security life cycle and is also less intrusive, avoiding waste of resources such as
power consumption in mobile phones. The takeaway message from this section is that albeit
both defensive strategies can be effective on their own, they are not mutually exclusive and
in fact may benefit vastly (in terms of effectiveness) from being combined.
Sandboxing. Creation of separate virtual spaces for the untrusted applications or code,
in order to run with limitations so as to diminish possible attack vectors: applications
run with no interactions with other applications and under tight restrictions in the
underlying host system. Most modern mobile device operating systems, such as
Android, iOS, and Windows Phone, run their applications in sandboxed environments.
Personalized approval. Detailed analysis of each application’s conformity to security
policies before being approved for distribution. The most common example of this
technique is Apple’s App Review system wherein each submitted application goes
through a series of meticulous review steps before becoming available in the App
Store. Microsoft has a similar system for the Windows Phone App Store. By contrast,
Google has no similar policies for applications available in the Google Play Store.
Code and asset assessment. Well-known types of malware can be identified by distinct
signatures. Most antivirus protection mechanisms rely on signature databases to
identify potential threats to the system. Another way of assessing applications is
to check which system calls, frameworks, and methods they use and under which
circumstances. Both iOS and Windows Phone enforce this behavior through their
official application stores, each submitted application for which is inspected before
becoming available.
Compartmentalization. The basic premise is to completely separate the user’s personal
space from the work space within the device, avoiding unnecessary compromises and
encapsulating threats from the personal space. The work space is usually subject to
stricter security restrictions and might even not allow installing or running applications
not allowed by security policies. Android devices can have user accounts that are
managed by the main account, which can have a more limited set of permissions.
Trusted party management. This method relies on the verification of trusted certificates,
keys and signatures to manage which entities can interact with the system or which
applications can be installed. For instance, only a single trusted computer might
be able to write to the mobile device’s storage (aside from the device itself) or only
apps approved and properly signed by a company beforehand might be installed on
the device. Android, iOS, and Windows Phone all have the capability to install and
manage custom trusted enterprise applications in the devices.
Permission systems. One way of circumventing the ordeal of assessing applications’
functionalities or used tools is to leave it to the user to either accept or reject a
list of granted permissions. Android and iPhone apps, for instance, must explicitly
An Introduction to Mobile Device Security ◾ 15
detail which system features or hardware capabilities they (might) need access to.
For Android devices, this is a mandatory step performed before the app is installed
in the device, while for iPhone devices each individual permission will be asked
during runtime when needed for the first time. In both scenarios, this information
can be checked before installing the application and it is up to the user to gauge the
risk when granting access to sensitive features, such as access to the camera or SD
storage.
Authentication schemes. These comprise the use of encryption standards, with the
possibility of depending on the existence of an external super user. The idea is to lock
system management behind complex password/PIN mechanisms before any (or even
every) write or read action is performed on the system. Most modern mobile operating
systems come with the option to encrypt the phone regarding a locking mechanism
(usually a PIN code or a fingerprint) without which the contents of the phone cannot
be accessed.
Limited time access. Ephemeral fixed-length sessions are scheduled for the device’s usage,
and all services are interrupted or aborted when the allocated time slot elapses. Not
available by default, this method is usually implemented at application level by using
timed access tokens.
1.3.5.2 Monitoring
Monitoring is an important component of the security life cycle, enabling detection
and profiling of malicious activities within the system, during runtime. Most common
approaches include the following:
Behavior analysis. Focused on what is and is not expected of each type of application, the
application or code is scrutinized during runtime for any anomalous or suspicious
activity, for detecting unwanted accesses or transfers of delicate or out-of-scope data.
This process may be coupled with a training phase or expected default behavior
thresholds for known applications [11,14].
Log analysis. The host system logs systematic information regarding memory and battery
usage, storage access, data transfers, and used services (e.g., Bluetooth, Wi-Fi, mobile
data, etc.) to portray the app’s true nature. The logs are periodically sent to a trusted
supervising server to delegate the heavier, more resource-intensive, analysis burden
out of the mobile device, albeit some minor analysis can still be performed on site.
Log integrity measures should be considered on both end points for this method to
work properly [8,30,34].
System call hooking (SCH). The act of altering the underlying host system for more fine-
grained logging of the system’s function calls and frameworks used (along with other
features) with the goal of easing the monitoring task [15]. This can help detecting
unnecessary use of mobile device resources such as cameras or microphones.
16 ◾ Mobile Apps Engineering
Runtime permission checks. Every hardware and software feature external to the
application requires explicit permissions for said actions to be granted at runtime,
at the host system’s level. One common example would be requesting permission
to use the device’s camera every time to stop a malicious application from stealthily
collecting unwanted pictures of the user or their surroundings. Android and iOS
have runtime permission verifications, allowing for the user to toggle or opt out of
permissions after installing the application.
The main advantages of monitoring security strategies include a better and more refined
assessment of the sensitive data and what actions or applications could be compromising it,
hopefully in time for intervention. They also enable a stricter control of what are acceptable
behaviors, through detailed logs and variable limitations. Given the limited computing
power and battery life, some of these methods can easily become an overkill for the device
or rely too heavily on consistent and systematic connection with secure networks and
servers, which might not be a possibility, depending on the use case scenario. Another
disadvantage is the risk of potential interventions in “real time” which, depending on
network status, system resources, cryptographic complexity, and connectivity issues, might
result in unacceptable latency.
It is worth mentioning that some monitoring methods cannot be implemented out of
the box. A good example is SCH, which is very hard or even impossible to perform on
most mobile operating systems without rooting or running a custom modified version of
the original OS. Android is the most commonly adopted OS for such barred monitoring
techniques, because it is based on the Android Open Source Project and can be altered at
core level to accommodate the desired changes more easily.
1.3.5.3 Mitigation
Some of the preventive and monitoring techniques already described in the previous
sections can be considered attack vector or vulnerability mitigation techniques on their
own, but there are other means to repair or minimize the damage on compromised devices.
For instance,
Security policies. Detailing which devices may connect to an infrastructure, what types
of data they may contain, what constitutes sensitive data and which operating systems
and applications are accepted, in terms of acceptable use and penalties for misuse.
Patch support. The ability to submit updates or patches for an application or system
without having to physically access it can be sufficient to fix newly discovered
vulnerabilities or potential attack vectors.
Long-term support (LTS). After distribution of the system/application there is a time
frame for which the developer agrees to provide support for potential threats.
Remote control. If a device becomes compromised it can be wiped, reset, shutdown, or
locked remotely, removing the possibility for an escalated compromise or continued/
recurrent access to sensitive data.
An Introduction to Mobile Device Security ◾ 17
computers. This is because it can be harder to find suspicious applications solely on the
basis of their appearance rather than on their behavior without the constant monitoring
provided by antivirus or similar tools; thus, mobile devices rely on runtime approaches.
Table 1.4 summarizes the threats that can be prevented by monitoring mechanisms.
The most defective monitoring mechanism in terms of protection is runtime permission
checks; the remaining mechanisms seem equally effective against most threats. However,
since SCH is usually not readily available on most mobile devices, and behavior analysis
requires a priori training, log analysis seems to be the most effective technique that can be
employed out-of-the-box.
Although prevention and monitoring can strongly improve security, there will always be
new malware or attack vectors against which they are ineffective. The best examples of are
zero day, undisclosed, and undetectable exploits, ranging from target-specific applications
such as Windows’ Stuxnet to global pandemics such as Android’s Stagefright. For such
threats, mitigation is a more suitable approach.
Mitigation strategies may be applied in the different phases of threats: before, during, or
after it is detected or results in damage. Table 1.5 analyzes the point at which each of the
addressed mitigation strategies can help handle a potential threat.
The security life cycle mentioned in the previous sections considered three phases, at
which distinct security approaches can be applied. It should be noted that other approaches
can be considered, such as the observe-orient-decide-act (OODA) loop [12]. OODA is a
common approach used by military, commercial operations and learning processes. The
Security Policies •
Patch Support • •
Long Term Support • •
Remote Control • •
Location Tracking •
Full/Coordinated Disclosure •
Recall for Analysis • • •
User Feedback •
Documentation •
An Introduction to Mobile Device Security ◾ 19
main advantage of OODA is that it focuses on agility when dealing with a threat in order
to mitigate its advances and damage at any given point in time, learning from any form of
input and feedback obtained.
OODA considers four distinct phases: Observe, which includes the identification of
threats (1); Orient where security approaches are planned according to the threats identified
in the previous phase (2); Decide where prevention strategies are put in place (3); and Act,
which includes for instance the mechanisms mentioned in the monitoring and mitigation
phases (4). A clear distinction of the OODA approach is that all the phases provide feedback
to the Observe phase, in order to assure that all the identified security threats are correctly
identified and addressed in the following phases.
TABLE 1.6 Comparison of Mobile Device and Application Management (MDAM) Frameworks
Samsung KNOX Android for Work Flyve MDM Apple DEP
Secure Boot •
Profile Isolation • •
Deployment of Security Policies • • • •
Deployment of Apps • • • •
Dedicated App Store • •
Device Monitoring •
Remote Data Wipe • • •
Secure Execution •
Supported OS Android Android Android iOS
Table 1.6 summarizes the functionality and features of these MDAM frameworks.
Samsung KNOX has many security features lacked by other MDAM solutions because
it is a product focused more on security than management, while the others are clearly
management solutions with some security features.
Dedicated application stores, such as Enterprise App Stores, are usually managed and
maintained as part of a mobile application management (MAM) policy. Its usage can
be part of the security policies deployed in the device, allowing organizations to ensure
adequate prevention measures regarding which applications are installed on the device.
Such policies may also provide the means to control the distribution and deployment of
applications downloaded from the official app stores (which may be proxied/cached by the
Enterprise App Store), controlled via white and/or blacklist mechanisms. Overall, it can be
considered that dedicated application stores combined with the security policies provide
corporations with finer control.
the foreground space. It is, however, a consequence of user interaction with smaller displays
and reduced available resources.
This brings us to event management, the response to limited multitasking in mobile
devices. Since usually only one application is using the device’s foreground space, any other
application or service that wishes to interact with the user through the foreground space must
announce it’s intentions, and this is done with system events. What’s more, some systems
divulge most of their runtime changes or allow for their tracking through system-wide
event broadcasting, which opens the door to smarter event management. An application
that requires specific resources can adapt its behavior based on the system’s state.
The application does not dynamically load code from outside the application’s Android
PacKage (APK).
The application uses strong, platform-provided cryptographic algorithms and does not
implement custom algorithms.
The application uses a properly secure random number generator, in particular to
initialize cryptographic keys.
24 ◾ Mobile Apps Engineering
Any of these aspects can be exploited by malware or malicious users, so Google has
decided to inspect Android applications submitted to the Play Store for potential misuse
regarding them, issuing red flags where deemed fit.
One outcome that might arise from the preventive enforcement of security policies is that,
since security policies are disclosed on public domain (or at least to registered developers),
malicious agents can avoid them upfront, attempting to circumvent them and target other
security blindspots or loopholes.
Using internal storage. In Android the files created on internal storage are accessible only
to the application that created them. To share data with other processes, developers
must use content providers, offering read and write permissions to other applications.
Furthermore, to provide additional data protection for data that is sensitive, local files
may be encrypted.
Permissions. Since Android employs a sandboxing approach, the applications must
explicitly share resources and data. In this sense, if they need to access additional
features that are not provided by the basic sandbox, they must declare the required
permissions. The number of permissions an application requests should be minimized,
and special attention must be paid when requesting sensitive permissions. This reduces
the risk of permission misuse and makes the application less vulnerable to attackers.
Also, it is advisable that the application does not leak any data that it has acquired via
a granted permission.
Networking. Networking on Android is similar to other Linux environments, therefore
internet application communication should employ HTTPS wherever it is possible,
to mitigate the risks of accessing public Wi-Fi networks. Moreover, to ensure that
other communications stay secure, SSL/TLS should be employed. Furthermore, the
An Introduction to Mobile Device Security ◾ 25
be stored differently depending on its nature and purpose. For instance, both Android and
iOS enable applications to store information in some of the following ways:
Application only. Stored information is only visible to the application that wrote it.
Internal storage file system. Data is stored on the device’s internal storage where,
depending on the operating system, it might be visible to other applications.
External storage file system. Data resides on a storage medium that can easily be exchanged
or removed from the device, and it is visible to all other applications.
Database. All information is stored and managed by a database that, depending on its
location, may be visible to other applications. For instance SQlite, the most commonly
used mobile system lightweight database, can be set up to encrypt its contents.
Unfortunately, all these storage methods are vulnerable to misuse, and even though the
system might ensure that sensitive content is kept private from other applications under
normal circumstances, usually the same cannot be assured for rooted devices or hacked
user accounts. This means that if an application that handles sensitive data, stored in a
secure fashion, is installed on a rooted device or if another application manages to attain
root privileges (e.g., privilege escalation) then the application’s data might be compromised.
1.5.6 Authentication
Perhaps the most common form of enforcing security on mobile devices is by establishing
authentication barriers before the user can access sensitive information or functionalities,
of which the most widely available are biometric data (fingerprints, face recognition,
etc.), passwords, PIN codes, and patterns. These can also be paired with other forms of
authentication such as the device’s location (where only certain environments are deemed
trustworthy).
There are several types of biometric authentication mechanisms, among which the
following are the most commonly cited:
Face recognition. By mapping key points and facial features of an individual’s face, a
picture or video can be analyzed and the subject identified or verified.
Fingerprint. The most commonly used biometric authentication method, regarded as
unique even between twins. Fingerprints do not change over time and can be easily
mapped to an identity.
Hand veins. When viewed under infrared light, the veins near a hand’s surface become
visible, and these can be treated as features, much like fingerprint ridges.
Iris scan. Irises are unique between individuals; however, since they can contract and
dilate depending on the ambient lighting, iris scans are often performed under a more
controlled environment.
An Introduction to Mobile Device Security ◾ 27
Palm print. Instead of analyzing a digit, the whole palm of the hand is scrutinized,
allowing for more features to be identified.
Signature. The user writes his/her signature and its shape and the writing process are
analyzed.
Speaker recognition. Unlike voice recognition, which aims to differentiate sounds from
words, speaker recognition attempts to differentiate one person from another. This
can be achieved by speaking a known word or sentence and analyzing how each
individual does it differently.
As one might correctly speculate, not all these authentication methods are equally secure
or practical, which is why, in the mobile context, only fingerprint and facial recognition
have been adopted by mobile device manufacturers. Moreover, these systems are fallible,
with possible false positives and false negatives. As the sensors for these technologies
become more compact and reliable, it is only sensible to include them in mobile devices,
as they provide a more comfortable authentication experience without compromising
security, as opposed to memorizing or carrying around very long and cryptographically
secure keys/passwords.
1.5.7.1 Virtualization
Virtualization aims to decouple the physical hardware from the OS. Inherent in
virtualization is the concept of a hypervisor, which is a software component responsible
for the scheduling of tasks and the management of the device’s resources for the virtual
machines. There are two categories of hypervisors: a type 1 hypervisor runs directly on the
hardware and provides the available resources to the guest OS; a type 2 hypervisor runs
on an operating system that provides the I/O resources. Even though type 1 hypervisors
offer better performance and profile isolation, they have an increased burden on CPU and
memory, since each virtual machine executes its own complete kernel and OS instance.
Type 2 hypervisors have a lower degree of isolation between profiles but also offer lower
OS switching overhead as certain portions of the host kernel and OS instance are shared.
There have been a few attempts to introduce virtualization into mainstream mobile devices
but, up to now, this remains a very small niche approach for special-purpose ecosystems.
28 ◾ Mobile Apps Engineering
1.6.1 Monitoring
Monitoring on the device can be performed through the collection of several parameters
that provide information regarding the events that are occurring. Such parameters include
application permissions [38], system calls, intents, API calls, used devices, and behavioral
data such as performed calls, sent messages, taken photos, connected networks, and visited
sites, among others.
The monitored parameters are important for performing intrusion detection, as described
in Section 1.6.2. Data collection mechanisms may be based on polling mechanisms, where
items are collected at certain intervals, or be always active. Mechanisms that are always
active constantly listen to system events, for instance by implementing broadcast receivers
in Android to collect information from system events (recall Section 1.3.1).
Even though they are important tools for malicious application detection, IDSs have
several limitations. For instance, they rely heavily on the information that the tools on the
devices provide to operate properly. Their accuracy can be hindered by events on the host
such as reboots, modification of system files, and application installation/uninstallation.
These events can be detected with success but the nature of the processes which originate
them cannot be discovered without additional information on the context. Detection of
such events without additional information can easily lead to false positives.
Static and dynamic mechanisms have unique drawbacks that hybrid mechanisms try to
improve upon. Nevertheless, hybrid mechanisms may also be thwarted in emulator-based
approaches which is a matter of concern.
In static analysis specifically, there can be problems with the detection of leakage of
sensitive information when malicious application behaviors do not trigger permission
checks or when they use only a single permission to extract sensitive information. When
using specification languages, it is important to take into account that the malicious
application may have features that are not expressible in the specification language, resulting
in detection evasion. Furthermore, there are several technological limitations [45] that are
important to address:
Alert generation delays. Even though the agents running on the host generate alerts in
real time for the majority of detection techniques, some are only triggered periodically
to collect information about events that have already occurred. This means that some
events can have a delay between actually occurring and being identified.
Centralized reporting hijacking and delays. Many techniques require the alert
information to be forwarded to a centralized management server. It is possible that
the communication to a centralized server is intercepted in order to provide false
information regarding the malware behavior. Also, by sending the data periodically
rather than in real time, it is possible to reduce overhead in the system’s components
and on the network. Smaller host-based intrusion detection system (HIDS)
implementations are more prone to transfer data on a more regular basis, but larger
implementations may have larger intervals at which data is transmitted. This can also
An Introduction to Mobile Device Security ◾ 31
cause delays in response actions, thus increasing the impact of quickly spreading
incidents, such as malware infections.
Host resource usage. These systems require the hosts to have agents running in them
to monitor the information, thus needing the host’s resources to perform their
operations. The agents can have a negative impact on the memory, processor usage,
disk storage, network, and file system usage.
Conflicts with existing security controls. Installing an agent on the host can cause
conflicts with security controls and other components that also intercept host activity.
Therefore, to identify potential conflicts, the agents must be tested on hosts that are
running security components such as those present on the hosts on which they will
be deployed.
Nowadays, IDPS systems are employed to assure that security is provided in most
stringent scenarios. For instance, in mission-critical scenarios like PPDR the usage of such
systems complements the other security approaches, such as prevention with dedicated
application stores. Indeed, by analyzing the monitored data, IDPS systems are able to
provide reaction to threats not known or categorized before [10].
1.7 CONCLUSION
Despite their (often) small form-factor and apparently humble capabilities, (especially
when compared with their bigger computing counterparts, such as desktop PCs), mobile
device security constitutes a considerable challenge. This is due to factors such as the sheer
amount of connectivity alternatives, the dominant usage profiles, or the ease of access or
theft, associated with many of the problems that have plagued more traditional computing
devices and their software for decades.
We have addressed a plethora of topics in this chapter regarding mobile device security.
We started by analyzing the current open challenges such as the evolution of mobile
device complexity, and the risks associated with the information generated by the use and
ownership of these devices, intending to demystify the common assumption that mobile
devices are simple in nature, when in reality they have become more and more complex
throughout the years, holding an ever-increasing influence on our daily lives. From there
we moved on to the core concepts that should be considered when thinking about mobile
device and mobile application security, which can be different depending on the target
environment.
Corporate and consumer environments can be very distinct when it comes to
safeguarding sensitive information, particularly when considering the implications of
enabling compromisable devices in compromisable networks. All of these considerations
warrant adequate mobile device management analysis and corresponding policies. This
security approach can come in various flavors: from prevention, to monitoring and detection,
to reaction. There are of course some entities or platforms already in place for such an
endeavor, each with their own strengths and weaknesses, but all with the added benefit of
already having proof-of-concept and test user bases to uphold security technologies.
32 ◾ Mobile Apps Engineering
There are also techniques that one can employ without relying completely on a third
party’s security, among which are some basic considerations regarding application
development, the importance of following preestablished security policies and guidelines,
how to isolate sensitive data from prying eyes through encryption, and authentication
mechanisms, and others.
It is our hope that, after reading this chapter, the reader has gained more insight into
the sheer number of possible attack vectors, with more constantly being added to the list,
as well as the means with which to hinder them during application development or mobile
device management.
REFERENCES
1. A. Bello Garba, J. Armarego, D. Murray, and W. Kenworthy. Review of the information
security and privacy challenges in bring your own device (BYOD) environments. Journal of
Information Privacy and Security, 11(1):38–54, 2015.
2. M. Alsaleh, N. Alomar, and A. Alarifi. Smartphone users: Understanding how security
mechanisms are perceived and new persuasive methods. PLOS ONE, 12(3):1–35, 2017.
3. Android Developers. Permission Element, 2018. Available at: https://developer.android.com/
guide/topics/manifest/permission-element (last accessed September 17, 2018).
4. Apple. Apple business, 2017. Available at: https://www.apple.com/lae/business/ (accessed
September 17, 2018).
5. Apple. iOS application security guidelines, 2018. Available at: https://www.apple.com/business/
site/docs/iOS_Security_Guide.pdf (accessed September 17, 2018).
6. Google Android Application Quality Guidelines. Core app quality, 2017. Available at: https://
developer.android.com/docs/quality-guidelines/core-app-quality (accessed September 17,
2018).
7. Arm. Security on Arm Trustzone, 2018. Available at: https://developer.arm.com/technologies/
trustzone (last accessed September 17, 2018).
8. M. Becher and F. C. Freiling. Towards dynamic malware analysis to increase mobile device
security. In Proc. of SICHERHEIT, P-128, pages 423–433, 2008.
9. Google Security Blog. From chrysaor to lipizzan: Blocking a new targeted spyware family, 2017.
Available at: https://security.googleblog.com/2017/07/from-chrysaor-to-lipizzan-blocking-
new.html (accessed September 17, 2018).
10. P. Borges, B. Sousa, L. Ferreira, F. Sagheczchi, G. Mantas, J. Carlos Ribeiro, L. Cordeiro, and
P. Simoes. Towards a hybrid intrusion detection system for android-based PPDR terminals.
In 3rd Workshop on Security for Emerging Distributed Network Technologies, DISSECT 2017,
IM, May 2017.
11. A. Bose, X. Hu, K. G. Shin, and T. Park. Behavioral detection of malware on mobile handsets. In
Proceedings of the 6th International Conference on Mobile Systems, Applications, and Services,
MobiSys ’08, pages 225–238. ACM, New York, NY, USA, 2008.
12. J. R. Boyd. Presentation: The essence of winning and losing, 1995, pp 3. Available at: http://
pogoarchives.org/m/dni/john_boyd_compendium/essence_of_winning_losing.pdf (accessed
September 17, 2018).
13. B. Bulgurcu, H. Cavusoglu, and I. Benbasat. Information security policy compliance: An
empirical study of rationality-based beliefs and information security awareness. Management
Information Systems Quarterly, 34(3):523–548, September 2010.
14. I. Burguera, U. Zurutuza, and S. Nadjm-Tehrani. Crowdroid: Behavior-based malware
detection system for android. In Proceedings of the 1st ACM Workshop on Security and Privacy
in Smartphones and Mobile Devices - SPSM ’11, page 15, 2011.
An Introduction to Mobile Device Security ◾ 33
15. C. Willemsm, T. Holz, and F. Freiling. Toward automated dynamic malware analysis using
cwsandbox. IEEE Security and Privacy, 5(2):32–39, 2007.
16. V. Chandola, A. Banerjee, and V. Kumar. Anomaly detection. ACM Computing Surveys,
41(3):1–58, 2009.
17. J. Cheng, S. H. Y. Wong, H. Yang, and S. Lu. SmartSiren: Virus detection and alert for
smartphones. In Proceedings of the 5th International Conference on Mobile Systems, Applications
and Services – MobiSys ’07, page 258, 2007.
18. CloudFlare. Mobile ad networks as ddos vectors: A case study, 2015. Available at: https://blog.
cloudflare.com/mobile-ad-networks-as-ddos-vectors/ (accessed September 17, 2018).
19. J. Concepcion, J. Chua, and G. Siy. Securing android byod (bring your own device) with
network access control (nac) and mdm (mobile device management). In DLSU Research
Congress 2015, De La Salle University, Manila, Philippines, 2015.
20. Android Developers. App security best practices, 2018. Available at: https://developer.android.
com/topic/security/best-practices (accessed September 17, 2018).
21. C. J. D’Orazio, K. K. R. Choo, and L. T. Yang. Data exfiltration from internet of things devices:
iOS devices as case studies. IEEE Internet of Things Journal, 4(2):524–535, 2017.
22. A. M. French, C. Guo, and J. P. Shim. Current status, issues, and future of bring your own device
(BYOD). Communications of the Association for Information Systems, 35(10):191–197, 2014.
23. GlobalPlatform. Available at: https://globalplatform.org/ (accessed September 17, 2018).
24. GlobalPlatform. Globalplatform device technology TEE client API specification table
of contents, 2010. Available at: https://globalplatform.org/specs-library/tee-client-api-
specification/ (accessed September 17, 2018).
25. GlobalPlatform. Globalplatform device technology TEE internal API specification,
2011. Available at: https://globalplatform.org/specs-library/tee-internal-core-api-
specification-v1-1-2/ (accessed September 17, 2018).
26. GlobalPlatform. Trusted user interface API v1.0, 2013. Available at: https://globalplatform.org/
specs-library/trusted-user-interface-api-v1/ (accessed September 17, 2018).
27. Nico Golde. SMS Vulnerability Analysis on Feature Phones. PhD thesis, Technical University
of Berlin, Berlin. Germany, January 2011.
28. Google. Android Enterprise, 2018. Available at: https://www.android.com/enterprise/ (accessed
September 17, 2018).
29. G. Greene and J. D’Arcy. Assessing the impact of security culture and the employee-
organization relationship on is security compliance. In 5th Annual Symposium on Information
Assurance (ASIA’10), page 1, 2010.
30. M. Halilovic and A. Subasi. Intrusion detection on smartphones. arXiv e-print 1211.6610,
2012. Available at: https://arxiv.org/ftp/arxiv/papers/1211/1211.6610.pdf (accessed September
17, 2018).
31. J. T. Jackson and S. Creese. Virus propagation in heterogeneous Bluetooth networks with
human behaviors. IEEE Transactions on Dependable and Secure Computing, 9(6):930–943,
2012.
32. C. M. Jones. Utilizing the Technology Acceptance Model to Assess Employee Adoption of
Information Systems Security Measures. Nova Southeastern University, Fort Lauderdale, FL,
USA, 2009.
33. H. Marques et al. Wireless public safety networks 1: Overview and challenges. In Next-
Generation Communication Systems for PPDR: The SALUS Perspective, pages 49–93. Elsevier,
New York, NY, USA, 2015.
34. S. Mazumdar and A. Paturi. Tamper-resistant database logging on mobile devices, 2011. World
Congress on Internet Security (WorldCIS-2011), London, 2011, pp. 165–170.
35. Microsoft Buxton collection. Simon Cellular Phone/PDA (Personnal Digital Assistant),
1994. Available at: https://www.microsoft.com/buxtoncollection/detail.aspx?id=40 (accessed
September 17, 2018).
34 ◾ Mobile Apps Engineering
36. A. Mylonas, A. Kastania, and D. Gritzalis. Delegate the smartphone user? Security awareness
in smartphone platforms. Computers and Security, 34:47–66, 2013.
37. L. Constantin, PC World “New Windows malware tries to infect Android devices connected
to PCs”, 2014. Available: https://www.pcworld.com/article/2090940/new-windows-malware-
tries-to-infect-android-devices-connected-to-pcs.html (accessed September 17, 2018).
38. Android Open Source Project. Runtime Permissions, 2017. Available at: https://source.android.
com/devices/tech/config/runtime_perms (accessed September 17, 2018).
39. Radware. Mobile security threats on the rise as hackers can launch ddos attacks on their
mobile phones, 2016. Available at: https://security.radware.com/ddos-threats-attacks/cyber-
attacks-in-the-palm-of-your-hand/ (accessed September 17, 2018).
40. Dimensional Research. The growing threat of mobile device security breaches a global survey
of security professionals, 2017.
41. M. Sabt, M. Achemlal, and A. Bouabdallah. Trusted execution environment: What it is, and
what it is not. In IEEE Trustcom/BigDataSE/ISPA, Aalto University, Helsinki, Finland, volume 1,
pages 57–64, 2015.
42. Samsung. Whitepaper: Samsung Knox - Security Solution, May 2017. Available at: https://
www.samsungknox.com/docs/SamsungKnoxSecuritySolution.pdf (accessed September 17,
2018).
43. K. Scarfone and P. Mell. Guide to Intrusion Detection and Prevention Systems (IDPS)
Recommendations of the National Institute of Standards and Technology. Technical Report,
NIST, Gaithersburg, MD, USA, 2007.
44. S. Smalley and R. Craig. Security enhanced (SE) android: Bringing flexible MAC to android.
NDSS Symposium, 2013. Available at: https://www.ndss-symposium.org/ndss2013/ndss-
2013-programme/security-enhanced-se-android-bringing-flexible-mac-android/ (accessed
September 17, 2018).
45. G. Stoneburner, A. Goguen, and A. Feringa. NIST special publication 800-94 revision 1. Risk
Management Guide for Information Security, page 95, September 2012.
46. Teclib. Flyve mdm, open source mobile device management solution, 2017. Available at: https://
flyve-mdm.com/ (accessed September 17, 2018).
47. J. Vila and R. J. Rodríguez. Practical Experiences on NFC Relay Attacks with Android,
pages 87–103. Springer International Publishing, Cham, Switzerland, 2015.
Chapter 2
Model-Driven Design
of Connectivity-Aware
Mobile Applications
Steffen Vaupel, Gabriele Taentzer, and Michael Guckert
CONTENTS
2.1 Introduction 36
2.2 Software Architectures of Connectivity-Aware Mobile Applications 38
2.2.1 Classification of Mobile Applications 38
2.2.1.1 Application Domain and Example Applications 39
2.2.2 Mobile Transaction Models 41
2.2.2.1 Keypool Transaction Model 43
2.2.2.2 Escrow Transaction Model 45
2.2.3 Generic Extended Client–Server Model 46
2.2.3.1 Data Modeling and Initial Setup 47
2.2.3.2 Online Transaction Processing 48
2.2.3.3 Replication 48
2.2.3.4 Offline Transaction Processing 48
2.2.3.5 Synchronization and Reintegration 49
2.2.3.6 Commercial Products 49
2.3 Modeling of Connectivity-Aware Mobile Applications 50
2.3.1 Design Decisions 50
2.3.2 Data Model 50
2.3.3 Behavior Model 51
2.3.4 Graphical User Interface Model 53
2.3.5 Modeling of Connectivity-Awareness 54
2.3.5.1 Extract Data Object Access 55
2.3.5.2 Explicating Data Object Access 56
2.3.5.3 Restricting Data Object Access 58
2.4 Model Analysis, Evaluation, and Prototype Generation 59
2.4.1 Analyzing Data Object Access and Conflicts 59
35
36 ◾ Mobile Apps Engineering
2.1 INTRODUCTION
Reliable operation of mobile applications during movement in space is a challenge for
mobile application developers [44]. When a mobile device switches from one radio cell to
another [55], loss or limitation of connectivity is not unusual and should be handled by
the architecture of mobile applications. Mobile application developers rarely implement
online- and offline-capable mobile applications, although this would considerably increase
the usability of such applications and users are increasingly interested in online- and
offline-capable mobile applications [18]. Besides dealing with interrupted network access,
online- and offline-capable mobile applications are also more robust against server failures
and can reduce data traffic by using replication and caching of data objects.
Constructing mobile applications that are both online- and offline-capable requires
additional architectural components for replication, synchronization, reintegration, and
local transaction management. If data can be modified locally, mobile applications can
avoid or prevent the execution of potentially conflicting transactions [39], and thus ensure
conflict-free synchronization/reintegration of modified data objects.
Mobile application developers have to acquire considerable knowledge about online- and
offline-capable transaction management before they can design a mobile application that
possesses online- and offline-capabilities. During the initiation phase of a mobile application
development project, software development teams often have to chose an appropriate
architecture and a software platform (e.g., heading either toward a native and standalone
mobile application architecture in Android/iOS or a platform-independent web-based
mobile application) [29,60]. This choice thereafter dominates the development process and
may cause limitations. Upon being forced to decide whether to implement an online-only
or offline-only mobile application variant, mobile application developers must thoroughly
understand the relevant use cases, for example, processes and accessed data objects of
the planned mobile application. Currently, there is no conceptual tooling for evaluating
mobile application designs regarding their online and offline capability. Mobile application
developers do not get any support in assessing whether the effort to implement such an
online- and offline-capable mobile application would be reasonable; for example, there is
no assistance to predict whether the throughput would increase considerably compared
Model-Driven Design of Connectivity-Aware Mobile Applications ◾ 37
Modeling
App
model
FIGURE 2.1 Model-driven design process of online- and offline-capable mobile applications.
generated prototype follows the notion of horizontal prototyping [25]; that is, specific layers
of online- and offline-capable mobile applications are built for reuse. More precisely, the
generated prototype focuses on architectural components (e.g., application logic, replication,
and synchronization/reintegration functionality) that are required [68] to implement online-
and offline-capable mobile applications, with a simple generated graphical user interface that
may be replaced in further iterations. The generation step builds upon an existing framework
for the model-driven development of mobile applications [73] (cf. [71,74], and [72]).
This chapter is structured as follows. We present the foundation of connectivity-
aware mobile applications in Section 2.2. Next, we present the domain-specific modeling
language applied here and the model elements for modeling connectivity-awareness to be
used (Section 2.3). In Section 2.4, we explain how model analysis, design evaluation, and
prototype generation works in more detail. Finally, Section 2.5 presents related work and
concludes this chapter.
Application
type
Application
type
Central Online
Repli- Network
Data and cation Connection
transaction Hybrid Both
management Synchro-
nization
Connectivity-
awareness
Local Offline
Required Excluded
FIGURE 2.3 Architectural implications of the Application type and the required degree of
Connectivity-awareness.
implies that a mobile application, that is, a mobile application user, reads remote data
objects (e.g., passenger information system, dictionary, and encyclopedia) in a synchronous
or asynchronous way from a local or central storage, while a transaction system is reading
and writing data objects from/to a back-end server. Transaction systems usually involve
more than one mobile client, that is, they are multiuser transaction systems. Finally,
communication systems also receive and send data like transaction systems but require
additional real-time service quality. The different manifestations of the application type
feature depend on as well as influence other architectural features. Figure 2.3 shows
required/excluded features of the network connection (e.g., online, offline, both) for different
types of mobile applications. Moreover, these connection features imply different features
(e.g., replication, synchronization/reintegration) of the data and transaction management
of mobile applications. For example, a standalone system does not require any online
connection but needs some kind of local data and transaction management. In contrast, a
communication system requires an always-online network connection and excludes offline
operations. The data and transaction management of a communication system is provided
remotely by a central service (e.g., a back-end server).
The three biggest retailers [8] in Germany in 2017—Amazon [9], Otto [14] and Zalando
[16]—provide mobile applications for different platforms. However, none of them supports
transactions for viewing or ordering products and mobile payment in a disconnected mode.
Offering a replicated digital product catalog has a high potential. Users may view and
order products while they are offline and can send orders later to the back-end server when
the connection is reestablished. An inherent problem within this setting is the limitation of
mobile transaction methods for offline payments [65]. Since an order often requires payment
in advance, secure payment is a crucial component of most e-commerce applications
(e.g., 80% of popular online shops provide PayPal [22] as a payment service [8]). Payment
transactions usually contain an online clearing, and such transactions are not allowed to
be performed offline. Thus, mobile e-commerce applications for offline usage require offline
payment methods. However, involved data objects are very generic (e.g., mostly reflecting
some kind of account object) and operation on such data objects are rather simple.
In industrial settings, the problems are slightly different: mobile applications often support
or substitute for manual tasks such as keeping inventory, order picking, or maintenance
logging. Data objects involved are tailored to the surrounding business processes or real-
world objects. Likewise, operations on such data objects are often more complex than in
e-commerce and payment scenarios.
To sum up, mobile applications deal with either aggregated values (i.e., account balance and
warehouse stock) having a set of rather simple operations (e.g., increment and decrement) or
custom objects (as they occur in, for instance, a car rental) having a set of complex operations
(e.g., pick-up, refuel, and event of damage). A data object containing only an aggregated value
attribute is called a summable object; otherwise, it is to be called a custom object. If the set
of operations contains at least one operation that alters data objects, there is potential for
conflict, because data objects are accessed concurrently in multiuser environments. Online-
and offline-capable architectures are required to deal with this conflict potential, in particular
with the conflict-free management of such transactions across connection contexts.
In the following, we will take a closer look at two specific applications to demonstrate the
different ways in which data objects can be accessed: a payment application (covering an
example for a summable object with repeatable operations) and a course booking application
for fitness studio members (dealing with custom objects and more complex operations). We
start the discussion of each application with the assumption that there is no replication for
offline usage. This corresponds to a traditional client–server architecture.
2.2.1.1.1 Payment App First, we consider applications for making mobile payments such
as Apple Pay [19], Google Wallet [21], or PayPal [22]. Traditionally, a banking account is
administered on a server at the banking site. The dataset is mainly a single value (aggregate),
namely the account balance. This singleton is a so-called hot spot because every transaction
changes or accesses this value. The set of transactions in a banking account is very limited
(i.e., cash withdrawal, cash deposit, debit, credit, and getting account balance). For each
banking account, the number of users is also quite limited. The users of a banking account
are the bank itself and at least one bank client. The bank itself arranges debit and credit
payments from internal to internal and external accounts. Banking clients may perform
Model-Driven Design of Connectivity-Aware Mobile Applications ◾ 41
cash withdrawals or deposits. We assume that the account is a credit account which may
never get into debit state. Transactions causing a negative balance provoke a conflict
situation. A mobile variant of such a (simplified) mobile payment application shall be ready
for operation even if the network connection is interrupted, that is, if the server with the
account object is not reachable. The aforementioned payment applications are currently
unable to operate in a connectivity-aware manner. The following example demonstrates
a money transfer transaction and the impact that a loss of network connectivity has in an
online-only variant of the mobile application:
2.2.1.1.2 Course Booking App As the next example, we consider a course booking
application for fitness studio members. Examples of such applications are GymSync [12],
GymJam [11], and BookFit [10]. Registered fitness studio members can select course spots
to practice particular exercises—such as yoga and Pilates—within certain time slots. The
set of operations is very limited but, compared with payment applications, very specific
(e.g., making or canceling a reservation or checking if a course spot is available). Conflicts
are very likely because each member may select every course spot. Studio members may
set course preferences to indicate which courses they will select in the future. We assume
that the course booking application never allows overbooking of a course spot (conflict
situation). The aforementioned mobile applications are presently not connectivity-aware.
Hence, we are interested in an online- and offline-capable variant of such a (simplified)
course booking application. The following example shows a course reservation transaction
and the impact that a loss of network connectivity has in an online-only variant of the
mobile application:
might require concurrently executed transactions to have equal effects as the sequential
execution of the same transactions, that is, they must be serializable. The serializability of
simultaneously executed transactions can be ensured by obtaining different correctness
criteria that are based on read/write conflict definitions [27]. The transaction manager
(more precisely, a scheduler as part of it) can check the serializability of the scheduled
transactions dynamically during the execution of concurrent transactions. If a schedule of
simultaneously executed transactions is not equivalent to a sequential execution, some of
the transactions have to be canceled.
However, such a transaction model is not applicable to the mobile applications domain
because different mobile user transactions run on different mobile devices. Moreover due to
their interrupted network connection, they cannot send any information about the accessed
data objects. Thus, any kind of anomaly, for example reading of inconsistent values, can occur
while using a traditional standard transaction model in the domain of mobile applications.
Mobile transaction models deal with this problem and provide further concepts to
cope with locally performed transactions of different mobile users on isolated copies.
Such models implement three abstract functions: (i) First, a mobile transaction model
describes how data objects are replicated from a primary data storage (Replication). This is
a prerequisite for operating offline. (ii) Second, a mobile transaction model defines which
transactions are allowed on replicated copies (Operation) to ensure different properties (e.g.,
consistent reading of data objects, conflict-free synchronization/reintegration). (iii) Third,
a mobile transaction model defines how locally modified copies can be synchronized/
reintegrated to the set of primary copies (Synchronization/Reintegration).
Hirsch et al. [40] survey several mobile transaction models and compare them on the
basis of typical requirements for this application domain ([35,47,68,]). Serrano et al. [63,64]
and Panda et al. [54] analyze the existing approaches with respect to the well-known ACID
(atomicity, consistency, isolation, durability) paradigm. Mutschler and Specht [51] divide
mobile transaction models either into first-class transaction models that process transactions
offline but still need to be online to commit the transaction, or second-class transaction
models that process transactions offline.
The state of the art provides many approaches for conflict-allowing and semi-offline
operating mobile transaction models such as the Kangaroo transaction model [35], the
Preserialization transaction management technique (PSTMT) [34], the Prewrite transaction
model [50], the Two-tier transaction model [39], the Clustering transaction model [56–58],
the Reporting and co-transactional model [31], and the Isolation-only transaction model [49].
For this reason, we will focus more on mobile transaction models that are conflict-free and
able to finish a local transaction while being completely offline.
The two following examples show that conflict-allowing mobile transaction models are
inappropriate in our scenarios:
of the replicated account value. The transaction can happen offline via NFC. Later on,
the banking clients (debtor and creditor) reprocess the debit or credit transaction on
the primary copy to synchronize the account balance (online transaction). However,
if the debtor withdraws money and changes the primary copy before executing the
reintegration, the coverage of the account cannot be ensured as the bank is unaware
that the customer has already transferred money from the replicated account. Since
the account may be in the debit state, a conflict may arise.
As seen in both examples, conflicts may occur if a single shared data object (Payment
app) or a shared set data objects (Course booking app) is replicated in a trivial way, that
is, if the one-to-one copy and conflicting processes are not limited in any way. Hence, the
main idea of conflict-free mobile transaction models is to split the concurrently accessed
data objects in such a way that local modification cannot lead to any conflict during the
synchronization/reintegration. As we will see later (Section 2.4.1), the deactivation of
potentially conflicting processes can also guarantee a conflict-free operation. We have
selected the Keypool transaction model and the Escrow transaction model for a more detailed
description.
Mobile client 1:
Key ...
1 ...
ti on syn
Key ... l ica ch
r Key ...
rep Mobile client 2: on
.
1 ... Key ... 1 ...
replication synchron.
2 ... 2 ... 2 ...
3 ...
Custom objects
Pilates
Complex
makeReservation(Person)
cancelReservation(Person) Spinning
isCourseAvailable():Boolean
participant
0..*
0..1
courses
Person FitnessStudio
... ...
Mobile client 1:
Key ...
1 45
n re
int
tio eg
l ica 2 15
re ra
p n t.
Key ... re tio
int Key ...
eg
l ica ra
p t.
1 90 re 1 90
Mobile client 2: t .
a
2 30 re e gr 2 30
pl
ica int t.
Key ... re a
re tio gr
pl n i nte
ica re
tio 1 45
n
2 15
Summable objects
Account
amount:Int< ca >1
cashWithdraw(Int)
Repeatable
operations
cashDeposit(Int)
debit(Int)
credit(Int)
getAmount():Int
1 The annotation < ca > will be introduced in Section 2.3.5.3.
transaction model by Walborn and Chrysanthis [76] is an extension of the Escrow method
and employs so-called compacts, which encapsulates access methods, state information and
consistency constraints, to allow local conflict-free transactions.
Application logic
Local transaction
manager (TM)
Mobile transaction model(s)
Replication manager
Server (S)
Synchronization/Re-
integration manager Central transaction
Log manager (TM)
offline online
DB
FIGURE 2.8 Generic extended client–server model. DB, database; DBMS, database management
system.
Synchronization
and
Reintegration
Offline
transaction Online
processing transaction
processing
Pre-processing
Mobile Replication
Initial setup
transaction model(s)
Offline Online
one in the server, depending on its connection state. Moreover, the local transaction manager
comprises a replication manager, which is responsible for data replication to be used while
mobile clients are offline. Transactions processed offline are logged by the synchronization/
reintegration manager. Later, this log is used to reprocess the transactions performed offline.
Figure 2.9 shows the working model of the local transaction manager being used in our
architecture. Replication, synchronization and reintegration are independent generic steps,
while offline transaction processing implements the mobile transaction model including
some preprocessing (gray-colored area). Different mobile transaction models, such as
Keypool and Escrow, may be plugged in and work independently of the steps performed
online.
client- and server-side), a class model can be translated into a relational data model by
object-relational mappers (ORMs). ORM frameworks can create empty database schemes
from class models and convert objects into table rows. Similarly, database records may be
translated back into object structures.
2.2.3.3 Replication
The generic version of the extended client–server model will not follow the particular
replication method of a mobile transaction model but will copy the entire set of data objects
to the mobile clients (full replication). Furthermore, data objects will not be modified during
the replication step. The replication step is triggered by the clients. This is called pull-based
replication, which is opposite to push-based replication [41].
Smartface [23], and platform-specific built-in facilities such as Sync Adapter in Android
[17]. However, these tools do not support either real offline transaction management or
any particular conflict prevention. Developers must ensure conflict-free behavior of their
mobile applications: that is, implement conflict-avoiding mechanisms after a manual
identification of potential conflicts. Web-based mobile applications using HTML5 may also
use replicated data objects stored locally in in-memory databases of the browser; the local
storage, however, is very limited (up to 5 MB). Also none of these frameworks are combined
with analysis or simulation capabilities for reasoning about the design.
generated
Android application
EPackage
EClassifier
name:String
name:String
nsURI:String 0..* eClassifiers
0..* eSuperTypes
EClass
abstract:boolean EDataType
1 eReferenceType
0..* eStructuralFeatures
EStructuralFeature
name:String
lowerBound:int
upperBound:int
1
eAtttributeType
EReference
EAttribute
containment:boolean
eOpposite
0..1
eOpposite 0..1
(e.g., inheritance, aggregation, association). Data models are not only used to generate the
underlying object access facilities, but also to influence the presentation of data through
the graphical user interface. Sub-objects, for example, result in a tabbed presentation of
objects, attribute names are shown as labels (if not redefined), and attribute types define the
appropriate edit elements such as text fields, checkboxes, and spinners. Class and attribute
names are not always well-suited to be viewed in the generated mobile application—for
example, an attribute name has to be a string without blanks and other separators, while
labels in mobile application views may contain several words like “Account number”. In
such a case, an attribute may be annotated with the intended label.
enum
enum
Permissions
Permission Privileges
Sequence INTERNERT
permision:Permission READ ONLY
FILE SYSTEM
MODIFY
CAMERA
body 1 follower 1 MODIFY CREATE
0..* permissions MICROPHONE
ALL
...
elseBody 1
If body 1 Task
IfElse InvokeProcess
Delete
synchronized:EBoolean subProcess
1
While
1 object
ProcessContainer
Create
condition 1
processes 0..*
Expression
1 eClass Process
startTask 1
EClass
rhs 1
1 contain 0..* processes
Assign
CrudGui ProcessSelector
privileges:Privileges
lhs 1
anchor 1
EObject 0..* return
1 page
value 1 0..* arguments
Page
return 1
0..* variables
Variable 1 page
0..* return
changeable:EBoolean 0..* input
defaultValue:EString 0..* outputData InvokeGUI
scope:Sope
0..* outputAction
ETypedElement
enum 1 return Read
Scope 0..1 object
LOCAL 1 context
InvokeOperation
GLOBAL 0..* arguments
0..1 return long:EBoolean; EOperation
1 operation
The main constituents of a process model are processes that may be defined in a
compositional way. In particular, the modularity and reusability of existing processes
requires minimal effort for process modeling. The model element InvokeProcess calls a sub-
process. When invoking a process, the kind of invocation—synchronous or asynchronous—
has to be specified. Long-running processes (e.g., processor-intensive or network-intensive
processes) should be marked as asynchronous. These processes will be run in the background.
Model-Driven Design of Connectivity-Aware Mobile Applications ◾ 53
Each process has a name and several variables that may also serve as (return) parameters. A
parameter is modeled as a variable with a global scope, contrary to locally scoped variables.
The body of a process defines the actual behavior comprising a set of tasks ordered by
typical control structures; it is potentially equipped with permissions.
Permissions indicate the required rights (e.g., network, file access, Global Positioning
System [GPS]) of the mobile applications. There are a several predefined tasks covering basic
CRUD functionality on data objects (e.g., Create, Read, Update, and Delete), control structures
(e.g., If, If-Else, and While), the invocation of an external operation (InvokeOperation) or an
already defined process (InvokeProcess), and the view of a page (InvokeGUI). While the task
CrudGui covers the whole CRUD functionality with corresponding views, Create, Read,
and Delete just cover single internal CRUD functionalities.
Privileges can limit object access (e.g., Read-only, Modify, and Modify & Create) of
the element CrudGui. An InvokeGUI task refers to a page defined in the GUI model. The
ProcessSelector points to all processes that are to be available in the main menu of the mobile
application.
ListStyleSettings listablepageStlye
separationColor 1
1 listStyle 0..1 listStyle:ListStyle
MenuStyleSettings showSeparator:EBoolean
menuStyle 0..1
menuStyle:MenuStyle
StyleSetting
fixedMenu:EBoolean
rgbColors
menuStyle 1
0...*
1
backgroundColor styleSettings 1..*
1 selectionStyle 0..1
RGBColor menues 0..* Menu
fontColor
green:EInt SelectionStyleSettings PageContainer
blue:EInt selectionColor 1 0..*
red:EInt listablePages
selectablepageStyle 0..* selectablePages
ListablePage
frameColor SelectablePage 0..*
1 1
pageStyle multiSelection:EBoolean
menu
pages 0..*
PageStyleSettings 1 ListPage 0..1
imagePosition:EInt pageStyle SelectableListPage
textPosition:EInt
frame:EInt menuablePages 0..*
ProcessSelectorPage
MenuablePage
CustomPage ELearningPage
Page
LoginPage ViewPage
enum enum
MenuStyle ListStyle
MediaPage RecordAudioPage
TILE GRID
GRID LIST
FIGURE 2.13 Metamodel for defining the graphical user interface of mobile applications.
amount of money that should be added and then invokes deposit(). The process
Withdraw also requires the amount of money to be withdrawn, invokes withdraw(),
and displays whether the transaction can be carried out or not. A simple GUI can also
be modeled and generated (see Figure 2.14f). The mobile application shown in Figure
2.15 is generated by our framework for the model-driven development of mobile
applications presented in [73]. The architecture of this mobile application follows a
traditional client–server architecture; that is, the mobile application is not operable
without a network connection.
Second, as shown in Section 2.2, mobile transaction models might restrict the data access
due to the split of custom objects or summable objects. Considering this, mobile application
developers must declare by explicit annotations which classes of the data model should be
handled in a connectivity-aware way.
InvokeGUI (ViewPage)
Action:Read/Write(Account): The task ChangeBalance
(InvokeGUI) shows an account on the page ChangeBalance
(EditPage). The account can be modified.
InvokeGUI (EditPage)
Action:Write(Customer.account): The creation of accounts
affects the class Customer because new accounts must be part of
a customer.
Create
Action:Read(Account): The task ReadAccounts (Read) returns all
data objects of the type Account.
Read
Action:Write(Customer.account): The task DeleteAccount
(Delete) deletes an account. Even the account is not accessed the
customer object is affected.
Delete
Action:Read(Account), Action:Write(Account, Customer.
account): The task CRUDAccount (CrudGui) provides reading
and modifying accounts. Moreover, the Creation and deletion of
accounts affects the class Customer.
CRUDGui (All)
Action:Write(Account.balance): The task Withdraw (Assign)
assigns a new value to the attribute balance.
Assign
Condition:Read(Account.balance): The conditional task (If/Else)
reads the attribute balance (and the unbound type Amount) and
branches to the appropriate path.
We will see later how these declarations are used during the model analysis step.
Return value commutativity conflicts (i.e., reading inconsistent values) are tolerable in
some scenarios, whereas state commutativity conflicts (i.e., lost updates) should usually be
avoided. Similar to the ANSI/ISO SQL [24,26] transaction isolation levels, we propose weak
and strict versions of the return value commutativity and state commutativity respectively.
Thus, developers can use a fine-grained definition for the required conflict-freeness.
Two offline transactions (not necessarily of the same process type) are called weakly
return value commutative if their return values may differ when being reprocessed on the
primary copy. This happens if other clients have changed the primary copy in the interim
period. Otherwise, they are called strictly return value commutative.
Two offline transactions (not necessarily of the same process type) are weakly state
commutative if the transformation of one state to another one may fail. This happens if
other clients have changed the primary copy in the interim period and hence the execution
condition of the failed transaction is no longer satisfied. They are strictly state commutative
otherwise.
The toleration of conflicts depends strongly on the application scenario of the mobile
application. We define four relevant conflict levels in order to define conflict strategies.
The conflict strategy is a global property: that is, all transactions have to follow the same
conflict level:
Level C1 (Conflict-allowing) requires weak return value commutativity and weak state
commutativity.
Level C2 (Conflict-avoiding) requires weak return value commutativity and strict state
commutativity.
Level C2-MTM (Conflict-avoiding using mobile transaction models) requires weak return
value commutativity and strict state commutativity, except state-changing transaction
which are performed on summable or custom objects. More precisely, transactions are
C2-MTM conflicting if they are C2-conflicting and will not use a mobile transaction
model.
Level C3 (Conflict-prohibiting) requires strict return value commutativity.
Note that weakness or strictness of state commutativity (Level C4) does not matter while
requiring strict return value commutativity, because state-changing operations, that is,
write operations, are not allowed. However, if the transaction set contains only writing
transactions that did not previously read any data object, the transactions are always strictly
state commutative because the state-changing transaction does not requires a particular
state. The conflict level C3 is equal to a standard conflict definition, for example, used in
online-only client–server architecture.
Conflicting processes are identified as follows:
• The conflict level C1 does not contain conflicting processes because any kind of
conflict is accepted by this conflict level.
62 ◾ Mobile Apps Engineering
• Two processes are C2-conflicting if one has a Condition:Read and the other has
an Action:Write relation with the same attribute/class in its conflict set.
• Two processes are C2-MTM-conflicting if one has a Condition:Read and the
other has an Action:Write relation with the same attribute/class in its conflict set.
Additionally, the attribute/class has no <ca> annotation.
• They are C3-conflicting if one has an Action:Read or a Condition:Read and
the other one has an Action:Write relation with the same attribute/class in its
conflict set.
If a mobile application has either read-only processes or processes with a write access,
albeit without a conditional read access, it may gain most of the connectivity-awareness as its
processes are conflict-free. All other mobile applications have to accept or resolve conflicts. We
can identify different kinds of mobile applications for which conflict levels are beneficial. The
conflict-allowing level, C1, is recommended for mobile applications that realize an information
system where the data flow would mostly be from the server to mobile clients. Conflict levels
C2 and C3 are rather suitable in transaction systems where the data flow is bidirectional
between the server and mobile clients. However, the appropriateness of a conflict level is mostly
determined by the number of users and data objects, that is by the conflicts that actually occur.
processes, modelers must manually explicate the data object access of these operations
by using additional language features as shown in Section 2.3.5.2. Moreover, the model
analysis can also consider the restrictions of data objects as described in Section 2.3.5.3.
Three out of the four processes of the payment app use customized operations. We have
chosen this example to explore all kinds of conflict levels in a single mobile application.
Output of the analysis step: As shown in Table 2.2, the analysis step delivers a conflict matrix
that at first shows all potentially conflicting processes. From this conflict matrix, a conflict-
free configuration for a particular conflict level can be derived (cf. Table 2.3) which will be
part of the input for the simulation step.
Withdraw × × ×
Deposit × ✓ ×
GetBalance × × ✓
64 ◾ Mobile Apps Engineering
conflict level. Choosing the conflict-allowing level C1, all processes can be offered (as
in the online mode, Figure 2.18a). Conflict level C2, however, requires the removal
of at least one conflicting process, which, in this case, happens to be Withdraw (see
Figure 2.18b). To reach conflict level C3, two processes have to be removed to prohibit
conflicts—these are Withdraw and Deposit (see Figure 2.18c) or Withdraw and
GetBalance (see Figure 2.18d) in this case. We recommend the conflict-avoiding level
C2 for the payment app: it ensures that the balance is always funded because money
cannot be withdrawn without checking that sufficient funds are available. In turn,
mobile users can check the balance and deposit money even when offline.
However, the conflict level is not only driven by the requirements at a mobile application
(with respect to conflict-freeness), but it also depends on the number of actual conflicts
taking place in the system. Developers are interested in understanding how throughput
would improve if such conflicts were accepted. Hence, a simulator can support developers
by estimating the throughput for different conflict levels.
Output of the simulation step: In contrast, the simulation system delivers the so-called
dependent simulation variables as output which is shown in Table 2.5. The number of
transactions processed by Client n is given by #Processed_Client_n. The overall system
throughput is the sum of these values. These dependent simulation variables are determined
for all conflict levels of the online- and offline-capable architecture as well as for the online-
only architecture.
for the online-only architecture while using a standard transaction model and
conflict definition (cf. Weikum and Vossen [77]). At the best connection level
(100%), the overall system reaches a throughput of 50%. It is not higher than that
owing to the occurrence of conflicts. It deteriorates as the average connection
level of the clients (users) declines. At the worst level (0% connectivity), there is no
throughput (0%). The Offline (C1/C2/C2 MTM/C3) graphs show the throughput at
different conflict levels. While even the C3 level, which is by far the most restrictive
level, provides a higher throughput than the online-only variant, the best variant
is actually shown by graph C2 MTM, which denotes the C2 level using mobile
transaction models in addition. The throughputs of C1, C2, and C3 variants
are almost equal for the simulated configuration. Another tested configuration,
shown in Figure 2.20, demonstrates that a conflict-prohibiting conflict level (C3)
deteriorates the throughput when conflicts occur rarely. In this case, it is advisable
to select the conflict-allowing level (C1). Besides, the use of a mobile transaction
model will provide only marginal improvements.
Initial setup: Given the data model, the model-object mapping framework Teneo [15] and
the object-relational mapping framework Hibernate [48] allow us to set up a relational
database scheme and to persist model instances in a server-located database.
Online transaction processing: Since Hibernate is a certified JPA provider [33,43], it
includes transaction session management that can be reused to handle the online
transaction processing.
Replication: Data replication is realized by loading the model instances from the database
(server), detaching them from the online session, and storing them locally on the
mobile devices.
Offline transaction processing: Offline transaction processing follows the selected conflict
level. All transactions are logged for later synchronization/reintegration and will be
executed on the server when the mobile devices are online again.
Synchronization and reintegration: Since we use a process model that defines the behavior
in an explicit way or define custom operations by attached program code in the data
model, the mobile applications can realize a transaction-based reintegration (cf. [66]).
Model-Driven Design of Connectivity-Aware Mobile Applications ◾ 69
By logging the object identifiers of accessed data objects and performed operations
(including parameters) in the offline context, a transaction can be repeated on the
server in the online mode.
model-driven reengineering of the prototype application took 128 hours, which includes the
review of the existing application and the back-end, including its application programming
interface, the modeling of the app model, and the indoor and outdoor tests. In contrast, the
former WeSense application development project produced nearly the same workload, but
the resulting application is not connectivity-aware. Hence, we demonstrate that the presented
model-based design process is both applicable and beneficial regarding the development effort.
2.5.1 Conclusion
To summarize, in this chapter we identify and present software architectures that are
useful for implementing online- and offline-capable mobile applications. We provide a
domain-specific modeling language tailored to the domain of mobile applications. This
allows modeling of connectivity-aware mobile applications. A model analysis step identifies
conflicting processes, which will be managed in a certain way while a mobile device is
offline. Model-based simulation predicts the number of transactions expected for an
application design, that is, an app model. Furthermore, a code generator can be used to
create runnable software prototypes of online- and offline-capable mobile applications.
The software prototypes can be used for experiments and as a starting point for further
development activities. Thus, the effort of realizing connectivity-aware mobile applications
can be reduced. The examples demonstrate that the number of overall transactions can be
increased because disconnected mobile clients are no longer inoperable.
We learned the following lessons during the development and use of our model-driven
design approach for connectivity-aware mobile applications:
data objects for offline operation of mobile applications. The model-driven infrastructure
provides this task and automatically generates mobile application with adequate behavior.
Moreover, we show the behavioral correctness of generated mobile transaction systems
using Colored Petri Net (CPN) models and corresponding model checkers [45].
• Model-driven development provides high-quality software prototypes: consequently,
the model-driven infrastructure applies design patterns for managing transaction and
data in a connectivity-aware mode. The generated software prototypes follow a widely
accepted software architecture.
• Model-based simulation helps mobile applications developers to decide whether an
application design is beneficial to operate in offline contexts.
REFERENCES
1. IBM DB2 Everyplace Installation and User’s Guide. ftp://ftp.software.ibm.com/software/data/
db2/everyplace/doc/enu/iug.pdf. (Accessed on August 13, 2018).
2. Adaptive Server® Anywhere 9.0.2—Adaptive Server Anywhere SQL User’s Guide. http://
infocenter.sybase.com/archive/topic/com.sybase.help.adaptive_server_anywhere_9.0.2/pdf/
asa902/dbugen9.pdf, October 2004. (Accessed on July 23, 2018).
Model-Driven Design of Connectivity-Aware Mobile Applications ◾ 73
68. R. Tewari and P. Grillo. Data management for mobile computing on the internet. In R. Brice,
C. J. Hwang, and B. W. Hwang, editors, Proceedings of the 1995 ACM 23rd Annual Conference
on Computer Science (CSC ’95). Association for Computing Machinery (ACM), New York,
USA, 1995.
69. H. Trætteberg. Using user interface models in design. In Computer-Aided Design of User
Interfaces III, pages 131–142. Springer, New York, NY, USA, 2002.
70. S. Vaupel. A framework for model-driven development of mobile applications with context
support. PhD thesis, Philipps-Universität Marburg—Fachbereich 12 Mathematik und
Informatik, 2018.
71. S. Vaupel, D. Strüber, F. Rieger, and G. Taentzer. Agile bottom-up development of domain-
specific ides for model-driven development. In Davide Di Ruscio, Juan de Lara, and Alfonso
Pierantonio, editors, Proceedings of the Workshop on Flexible Model Driven Engineering
Co-Located with ACM/IEEE 18th International Conference on Model Driven Engineering
Languages & Systems (MoDELS 2015), Ottawa, Canada, September 29, 2015, volume 1470 of
CEUR Workshop Proceedings. CEUR-WS.org, 2015.
72. S. Vaupel, G. Taentzer, R. Gerlach, and M. Guckert. Model-driven development of platform-
independent mobile applications supporting role-based app variability. In J. Knoop and U.
Zdun, editors, Software Engineering 2016, Fachtagung des GI-Fachbereichs Softwaretechnik,
23–26. February 2016, Wien, Österreich, volume 252 of LNI, pages 99–100. GI (German
Association of Computer Science), Bonn, Germany, 2016.
73. S. Vaupel, G. Taentzer, R. Gerlach, and M. Guckert. Model-driven development of mobile
applications for android and ios supporting role-based app variability. Software and System
Modeling, 17(1):35–63, 2018.
74. S. Vaupel, G. Taentzer, J. P. Harries, R. Stroh, R. Gerlach, and M. Guckert. Model-driven
development of mobile applications allowing role-driven variants. In J. Dingel, W. Schulte,
I. Ramos, S. Abrahão, and E. Insfrán, editors, Model-Driven Engineering Languages and
Systems - 17th International Conference, MODELS 2014, Valencia, Spain, September 28–
October 3, 2014. Proceedings, volume 8767 of Lecture Notes in Computer Science, pages 1–17.
Springer, New York, NY, USA,2014.
75. S. Vaupel, D. Wlochowitz, and G. Taentzer. A generic architecture supporting context-aware
data and transaction management for mobile applications. In Proceedings of the 3rd ACM
International Conference on Mobile Software Engineering and Systems, MOBILESoft 2016,
Austin, TX, USA, May 16–17, 2016. Institute of Electrical and Electronics Engineers (IEEE),
Piscataway, NJ, USA, 2016.
76. G. D. Walborn and P. K. Chrysanthis. Pro-motion: Management of mobile transactions. In
B. Bryant, J. Carroll, D. Oppenheim, J. Hightower, and K. M. George, editors, Proceedings of
the 1997 ACM Symposium on Applied computing (SAC ’97), pages 101–108. Association for
Computing Machinery (ACM), New York, NY, USA, 1997.
77. G. Weikum and G. Vossen. Transactional Information Systems: Theory, Algorithms, and the
Practice of Concurrency Control and Recovery. Series in Data Management Systems. Morgan
Kaufmann, Burlington, MA, USA, 2002.
Chapter 3
CONTENTS
3.1 Introduction 78
3.2 Mobile App Testing 78
3.3 Testing Levels and Their Goals 80
3.3.1 Unit Testing 80
3.3.2 Integration Testing 80
3.3.3 System Testing 80
3.3.4 Acceptance Testing 80
3.4 Types of Testing 81
3.4.1 Functional Testing 81
3.4.2 User Interface Testing 83
3.4.3 Performance Testing 84
3.4.4 Security Testing 85
3.4.5 Compatibility Testing 86
3.4.6 Usability Testing 87
3.5 Related Work 89
3.6 Mobile App Testing Environment and Its Particularities 90
3.6.1 Emulation-Based Testing 90
3.6.2 Device-Based Testing 90
3.6.3 Crowd-Based Testing 91
3.6.4 Cloud-Based Testing 91
3.7 Mobile App Testing Tools, Frameworks, and Services 91
3.7.1 Mobile Tools and Frameworks 91
3.7.2 Mobile Testing Services 94
3.8 Discussion 95
3.8.1 Selection of Components for Unit Testing 95
3.8.2 Test Case Generation 95
77
78 ◾ Mobile Apps Engineering
3.1 INTRODUCTION
Mobile applications are software systems that run on mobile devices and/or take in input
contextual information [39]. Today, such applications are fundamental to performance of
simple daily tasks, such as sending/receiving messages and playing games, but also in complex
activities, such as banking operations or health care. For instance, mobile devices have been
transformed into medical instruments that capture blood test results, medication information,
blood glucose readings, and medical images [55]. Moreover, mobile applications continue to
drive a large share of the information technology (IT) market. In March 2017, the number of
mobile applications (“mobile apps” or just “apps”), available for download in Google’s Play
Store was around 2.8 million and in Apple’s App Store was 2.2 million [52]. In June 2017,
Apple announced that 180 billion mobile apps had been downloaded from its App Store [51].
Due to the growth in the number and complexity of mobile apps, quality has been a
differential to obtaining advantages in a disputed market. Thus, the search for quality
becomes a greater concern for such applications. However, these apps present some additional
characteristics that are less commonly found in traditional software applications, some of
which include supporting a wide range of mobile platforms, mobile devices, interaction
with other applications, sensor handling, multiple input channels (e.g.: keyboard, voice,
and gestures). Such characteristics have direct implications for software development and,
consequently, for testing. Thus, it is important to pay more attention to these activities.
Mobile app testing is a collection of related activities with the aim of finding errors or
uncovering issues in some dimensions of the mobile app quality, such as content, function,
usability, navigability, performance, compatibility, and security [43]. Validating each
dimension of the mobile app quality requires the design of testing activities with specific
goals; that involves different types of testing. Mobile app testing is complex and high-cost
and requires a lot of effort. When it is performed by a human tester, it becomes extremely
repetitive and error-prone. Given this context, tester teams need to look into possibilities
to increase the testing efficiency.
Automated testing is a strategy frequently used for ensuring mobile app quality. It
involves multiple types of tests and frameworks. Knowing how to use all these tools is
very important as it allows developer and tester to choose which tools and frameworks are
appropriate for each type of testing.
This chapter provides an overview of mobile app testing, mainly regarding tools,
frameworks, and services used to support mobile app testing in their diversity of levels.
Also, a set of key issues and challenges surrounding diverse types of testing are broached.
mobility, usability, interoperability, connectivity, security, and privacy” [19]. This testing
has been both manual and automated. It has often failed to involve the actual user in terms
of user feedback, and analysis of app store reviews.
Mobile app testing can make use of the body of knowledge that exists for testing software
in general, since nothing inherent to mobile devices invalidates already existing testing
techniques and methods. However, this testing differs from the test approaches established
in many IT organizations in some key areas:
Mobile system requirements: Compared to desktops, mobile systems bring with them a
range of new requirements that companies need to take into account. Both Business
and quality assurance (QA) experts need to work together with previous defined
requirements to ensure that companies systematically and verifiably determine what
properties any mobile software should have. In addition, the correct definition of
requirements accelerates software development and testing.
Quality fingerprint: In principle, the quality criteria of mobile and traditional software
are no different. The focus, however, shifts to functionality, security, performance,
ease of use, reliability, portability, and maintainability. These criteria need to be
weighted differently for mobile solutions, creating a different “quality fingerprint”.
Mobile computing is differentiated by four constraints: limited resources; security
and vulnerability; the variability of performance and reliability; and ultimately finite
power sources.
Multichannel testing: The basic principles of software QA and software testing remain the
same with mobile systems. The essential aspect worth noting is that QA must ensure
effective management of the many types of mobile software, e.g., different operating
systems (OSs) such as iOS or Android, and also of different device classes such as
smart phones or tablet PCs.
Testware: The traditional procedures of software development and QA continue to apply
to mobile systems. However, considering the variety of OSs the same tool cannot be
used on iOS and Android. Additionally, new testing tools need to consider the ability
to test quality criteria such as security or efficiency.
Development and testing processes: When developing mobile systems, flexible process
models are essential because mobile products change more quickly and frequently than
traditional information technology. Iterative and incremental developmental models
are recommended, as they test the system requirements and their implementation
much more frequently than sequential procedures.
In a highly fragmented and competitive global market, the mobile development cycle
is of short period. For the vendor’s equanimity in the face of the overwhelming task of
ensuring long-term success, the mobile app must be tested over different combinations
of platforms, OSs, and networks before globally launching. In addition to this, similarly
to functional testing, nonfunctional testing such as security testing and usability testing
also play an important role. Effective test planning in mobile app testing helps to improve
80 ◾ Mobile Apps Engineering
the mobile app quality. So knowledge about types of test and testing techniques that will
be applied is essential to ensure the quality of the mobile app. Mobile app testing has four
levels, which will be described in the next section.
In the Budget Watch application, some functional tests must verify whether it allows for
creating, updating, and deleting a budget. In creating a budget, the type and the value are
mandatory. Thus, Figure 3.2 shows the Budget View Activity screen in which the budget
value has not been entered. In this case, an error message is displayed. The test case to check
whether the mobile app creates a new budget with no value is presented as follows:
Some challenges in automated functional testing are related to the test case generation,
the capture of context information, and isolating failures by mobile app layer. These
challenges are detailed below.
As with any testing, performance testing must have a defined objective, a structured
approach, and parameters defined before being carried out. An objective of the Budget
Watch application can be discovering performance based on different hardware/software
configurations for starting such a mobile app and adding a new budget (see Figure 3.3)
under varying network conditions. In Android applications, it verifies specified system
performance goals, such as execution time, responsiveness, memory usage, power
consumption, and network usage [6].
There are some challenges in automated performance testing:
4. Determining whether a mobile app is suffering from performance bugs, since they
gradually degrade the mobile app’s performance.
5. Performance testing is affected by the lack of effective test oracles and test data
generation techniques [31].
Another example of this type of testing is related to different layouts displayed as calendar
layouts or default buttons: for instance, in the mobile app used as an example, the difference
between the layout of some default buttons as “Done”, “Set”, and “OK”. The example is
shown in Figure 3.4. These default buttons may change according to the platform API
version and the brand of device.
Mobile App Testing ◾ 87
FIGURE 3.4 An example of the different layout of calendar and default buttons “OK” and “Done”.
According to the chosen heuristics, the system needs to be easy for lay users, but flexible
enough to become agile for advanced users. For evaluation, the exclusion of the Budget
function was chosen. Simulating a lay user, there are two possible ways to exclude a budget:
First way:
1. Opening the mobile app.
2. Clicking on the “Budgets” option.
3. Pressing an element from the list and waiting for the context menu.
4. Clicking on “Delete”.
Second way:
1. Opening the mobile app.
2. Clicking on the “Budgets” option.
3. Searching the “Exclude Element” button.
When performing any of the actions, the functionality is not found. An expert user could
find the option using the following steps and the flow of Figure 3.5:
In this option, there are numerous steps to be performed, even for an expert user, which
invalidates the heuristic of flexibility for that specific application.
There are some challenges faced by usability testing as follows:
There are no widespread principles about how to conduct usability field studies in the
mobile app domain [42]. Moreover, it is not known how to prioritize different user-centered
design evaluation criteria in mobile apps [25,54].
In order to understand the test automation culture prevalent among developers, Kochhar
et al. [29] investigate the current state of testing of mobile apps, the tools that are commonly
used by developers, and the problems faced by them. The authors report that Android
app developers use automated testing tools such as JUnit, MonkeyRunner, Robotium, and
Robolectric. These tools are discussed in later sections of this chapter.
Linares-Vásquez et al. [33] analyze the developer’s needs regarding practices and
preferences in designing, automated testing, and quality metrics. They then present a
perspective of automated mobile app testing with the purpose of reporting frameworks,
tools, services, and challenges.
Developers often use blogs and Question & Answer (Q&A) sites in the search for
solutions to their difficulties. Thus, Villanes et al. [58] investigate the main discussed topics
on Android testing using repositories of the Stack Overflow Q&A site. The authors analyze
testing tools, functional testing, and unit testing that were identified. They also analyze the
evolution of interest in Android testing tools.
Muccini et al. [39] discuss the development and testing of the mobile app. Types of mobile
applications, their peculiarities, and how they affect the research on mobile app testing are
investigated.
network), providing real insights into the functioning of the application. Performance of
real devices is better than other virtual options. As a test environment, developers use their
own smartphones (usually one device) to perform tests. However, this cannot cover all other
mobile brands, or OS versions.
• Robotium tool [48] enables easy to write automatic UI tests. It allows the writing of
function, system, and user acceptance test scenarios, spanning multiple Android
activities.
• Calabash [13] an acceptance testing framework. It supports Cucumber, which
expresses the mobile app behavior using natural language that can be understood by
TABLE 3.1 Mobile Testing Frameworks and Tools
Robotium Calabash Monkey Appium Roboletric Monkeyrunner Espresso JUnit Mockito Ranorex UIAutomator MonkeyTalk Neoload
Attributes [48] [13] [37] [7] [47] [38] [17] [27] [36] [45] [8] [53] [41]
Functional testing Yes Yes No Yes No Yes Yes No No Yes Yes Yes No
UI testing Yes Yes Yes Yes No No Yes No No Yes Yes Yes No
Unit testing Yes No No No Yes Yes Yes Yes Yes No Yes No No
92 ◾ Mobile Apps Engineering
Security testing No No No No No No No No No No No No No
Performance testing No No No No No No No No No No No No Yes
Usability testing No No No No No No No No No No No No No
Linux/Windows/Mac Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes L-W
Android OS Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
iOS No Yes No Yes No No No Yes No Yes No Yes Yes
Windows OS No No No Yes No No No No No No No No Yes
Mobile web applications No No No Yes Yes Yes No No No Yes N/A Yes Yes
Mobile native applications Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
Mobile hybrid applications Yes Yes Yes Yes Yes Yes Yes No No Yes N/A N/A Yes
Emulator/Device Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
Script language Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
Record and replay No Yes No No Yes Yes Yes No No Yes No Yes Yes
Open source Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No
Instrumentation No No No No No No No No No Yes Yes Yes N/A
Natural language No Yes No No No No No No No No No No No
Test reports No No No No No No No No No Yes No Yes N/A
Mobile App Testing ◾ 93
nontechnical people. It also supports all actions on the screen such as swipe, pinch,
rotate, tap.
• Monkey tool [37] runs on an emulator or mobile device and generates pseudo-random
streams of user events such as clicks, touches, or gestures, as well as a number of
system-level events.
• Appium [7] is a test automation framework. Its library functions inside the framework
make calls to the Appium server running in the background, which operates the
connected device. It can be used in frameworks with various languages such as Java,
Python, Ruby, and all others that Selenium web driver supports.
• Monkeyrunner tool [38] provides an API for writing programs that control an Android
device or emulator from outside of Android code. It is designed to test the functionality
of mobile apps and mobile devices and run unit test suites.
• Espresso testing framework [17] provides APIs for writing UI tests to simulate user
interactions within a single target app. It provides automatic synchronization of test
actions with the UI of the application under test (AUT).
• Ranorex [45] is a software testing tool that performs functional testing on desktop,
web, or mobile apps. It supports many UI technologies that include Java, HTML, C#,
Flex/Flash, Android, iOS, and Silverlight.
• MonkeyTalk [53] is a mobile app automation testing tool that automates real, functional,
interactive tests. It can be used for simple smoke tests or for data-driven test suites.
• UI Automator testing framework [8] provides a set of APIs to build UI testing that
performs interactions on user application and system applications. It enables: a viewer
to inspect layout hierarchy, an API to retrieve state information, and APIs that support
cross-app UI testing.
For performance testing, Neoload [41] is a load testing platform covering for cloud-
ready applications, microservices architected applications, mobile and “internet of things”
(IoT) applications, and enterprise-grade packaged application. Other types of testing, such
as security and usability testing, have no support tools. These types of testing are usually
supported by online services that will be detailed next subsection.
From Table 3.1 it can be seen that most applications are aimed at the Android platform;
among the tools mentioned, only two have Windows Phone support (Appium and Neoload)
and six have iOS support (Calabash, Appium, Ranorex, MonkeyTalk and Neoload). The wide
adoption by the Android platform can be deduced as an impact of the growth and adoption
of users to platforms, analyzing the current market and sales by platform is perceived a great
advance in sales of Android devices, with iOS in second place, followed by other platforms.
Analyzing the tools (Table 3.1), most of the tools (10 of 13) support native and hybrid
applications, accompanied by the growth of the use of the internet. It is increasingly
common to find applications that use native elements in the mobile market and market
94 ◾ Mobile Apps Engineering
trends have a great impact on such applications. Some characteristics that could influence
in the choice of the testing tools are: the type of testing, the type of application (native,
web or hybrid), the mobile platform and the testing environment. JUnit [27] is the most
popular framework used to write unit tests. Mockito [36] and Roboletric [47] enable the
writing of tests using the mocking approach. The former is used for making mocks of
classes. It allows the mocking all of dependencies of a particular class. The latter contains
many mocks of Android classes. It allows the tests to run on the java virtual machine
(JVM) without booting up an instance of Android. Although Robotium, Espresso,
and UIAutomator support functional UI testing, they can also be used to perform this
testing.
Most tools and frameworks support script language except the Monkey tool. Using such
techniques, the tester is required to manually write the test scripts that exploit the features
offered by a test automation framework in order to automatically interact with the mobile
app [5].
The record and replay technique reduces the effort of manually writing the test scripts
since they require minimal coding at the beginning. Most tools and frameworks support
record and replay. Although Robotium does not support such a technique, there is
another tool—Robotium Recorder—that offers support for it, but it is not open source.
Some framework and tool support partially captures multitouch gestures, for example,
Espresso and MonkeyTalk. MonkeyRunner works with the screen coordinates, while other
frameworks and tools that support UI testing allow identification of the screen components
by ID and text.
Most tools and frameworks are open source, except for Ranorex and Neoload tools.
Natural language is one of the formats preferred by Android developers for automatically
generating test cases [33]. It is only supported by the Calabash framework.
* https://www.xamarin.com
† https://aws.amazon.com/device-farm
‡ https://firebase.google.com
§ https://saucelabs.com
¶ https://bitbar.com/testing
** https://www.perfectomobile.com
Mobile App Testing ◾ 95
3.8 DISCUSSION
3.8.1 Selection of Components for Unit Testing
During unit testing, determining which set of components to use in order to balance
conflicting objectives such as cost of acquisition, development time, customer desirability,
and expected revenue is a highly complex task [24]. Moreover, testing of all available
components is computationally intractable [16]. SCOUT [16] treats the selection of
components for unit testing with limited resources as an optimization problem, addressing
two different objectives: maximizing benefits and minimizing testing cost.
REFERENCES
1. IEEE Std 610. IEEE Standard Computer Dictionary: A Compilation of IEEE Standard Computer
Glossaries. IEEE, Piscataway, NJ, USA, 1991.
2. IEEE Std 829. IEEE Standard for Software Test Documentation. IEEE, Piscataway, NJ, USA, 1998.
3. ISTQB. Standard Glossary of Terms Used in Software Testing. International Software Testing
Qualifications Board, Brussels, Belgium, 2015.
4. C.Q. Adamsen, G. Mezzetti, and A. Møller. Systematic execution of android test suites in
adverse conditions. In Proceedings of the 2015 International Symposium on Software Testing
and Analysis, ISSTA 2015, pages 83–93, ACM, New York, NY, USA, 2015.
5. D. Amalfitano, N. Amatucci, A.M. Memon, P. Tramontana, and A.R. Fasolino. A general
framework for comparing automatic testing techniques of android mobile apps. Journal of
Systems and Software, 125:322–343, 2017.
6. D. Amalfitano, A.R. Fasolino, P. Tramontana, and B. Robbins. Testing android mobile
applications: Challenges, strategies, and approaches. Advances in Computers, 89:1–52, 2013.
7. Appium. Project website: http://appium.io/ [Accessed February 27, 2018].
8. UI Automator. Project website: https://developer.android.com/training/testing/ui-automator.
html [Accessed February 27, 2018].
9. S. Baride and K. Dutta. A cloud based software testing paradigm for mobile applications.
SIGSOFT Software Engineering Notes, 36(3):1–4, 2011.
10. J.M. Christian Bastien. Usability testing: a review of some methodological and technical
aspects of the method. International Journal of Medical Informatics, 79(4):e18–e23, 2010.
Human Factors Engineering for Healthcare Applications Special Issue.
11. K. Blokland, J. Mengerink, and M. Pol. Testing Cloud Services: How to Test SaaS, PaaS, IaaS.
Rocky Nook Inc., Santa Barbara, CA, USA, 2013.
12. B. Bruegge and A.H. Dutoit. Object-Oriented Software Engineering Using UML, Patterns, and
Java. Prentice Hall, Upper Saddle River, NJ, USA, 3rd edition, 2009.
13. Calabash. Project website: http://calaba.sh/ [Accessed February 27, 2018].
14. G. Candea, S. Bucur, and C. Zamfir. Automated Software Testing as a Service. In SoCC ’10
Proceedings of the 1st ACM Symposium on Cloud Computing, Indianapolis, IN, USA. pages
155–160, ACM, New York, NY, USA, 2010.
15. S.R. Choudhary, A. Gorla, and A. Orso. Automated test input generation for android: Are we there
yet? In Proceedings of the 2015 30th IEEE/ACM International Conference on Automated Software
Engineering (ASE), ASE ’15, pages 429–440, IEEE Computer Society, Washington, DC, USA, 2015.
16. E.N. de Andrade Freitas, C.G. Camilo-Junior, and A.M.R. Vincenzi. Scout: A multi-objective
method to select components in designing unit testing. In IEEE 27th International Symposium
on Software Reliability Engineering (ISSRE) pages 36–46, IEEE, Piscataway, NJ, USA, 2016.
17. Espresso. Project website: https://developer.android.com/training/testing/ui-testing/espresso-
testing.html [Accessed on February 27, 2018].
18. M. Fazzini, E.N. De Andrade Freitas, S.R. Choudhary, and A. Orso. Barista: A technique for
recording, encoding, and running platform independent android tests. In IEEE International
Conference on Software Testing, Verification and Validation (ICST), pages 149–160, IEEE,
Piscataway, NJ, USA, 2017.
19. J. Gao, X. Bai, W.-T. Tsai, and T. Uehara. Mobile application testing: A tutorial. Computer,
47(2):46–55, 2014.
20. J. Gao, W.-T. Tsai, R. Paul, X. Bai, and T. Uehara. Mobile testing-as-a-service (mtaas) –
infrastructures, issues, solutions and needs. In IEEE International Symposium on High-
Assurance Systems Engineering (HASE), page 158–167, IEEE, Piscataway, NJ, USA, 2014.
21. R. Yanez Gómez, D. C. Caballero, and J.-L. Sevillano. Heuristic evaluation on mobile Interfaces:
A new checklist. The Scientific World Journal, Vol. 2014, Article ID 434326, 19 pages, 2014.
http://dx.doi.org/10.1155/2014/434326.
Mobile App Testing ◾ 97
22. F. Guaiani and H. Muccini. Crowd and laboratory testing, can they co-exist? An exploratory
study. In Proceedings 2nd International Workshop on CrowdSourcing in Software Engineering,
CSI-SE 2015, pages 32–37, IEEE, Piscataway, NJ, USA, 2015.
23. H.K. Ham and Y.B. Park. Designing knowledge base mobile application compatibility test
system for android fragmentation. International Journal of Software Engineering and Its
Applications, 8(1):303–314, 2014.
24. M. Harman, A. Skaliotis, K. Steinhöfel, and P. Baker. Search–based approaches to the component
selection and prioritization problem. In Proceedings of the 8th Annual Conference on Genetic
and Evolutionary Computation, GECCO ’06, pages 1951–1952, ACM, New York, NY, USA, 2006.
25. A. Hussain, N.L. Hashim, N. Nordin, and H.M. Tahir. A metric-based evaluation model for
applications on mobile phones. Journal of Information and Communication Technology 12:55–
71, 2013.
26. M.E. Joorabchi, A. Mesbah, and P. Kruchten. Real challenges in mobile app development. In
ACM/IEEE International Symposium on Empirical Software Engineering and Measurement,
pages 15–24, ACM, New York, NY, USA, 2013.
27. JUnit. Project website: http://junit.org/junit5/ [Accessed February 27, 2018].
28. H. Kim, B. Choi, and S. Yoon. Performance testing based on test-driven development for mobile
applications. In Proceedings of the 3rd International Conference on Ubiquitous Information
Management and Communication, ICUIMC ’09, pages 612–617, ACM, New York, NY, USA,
2009.
29. P.S. Kochhar, F. Thung, N. Nagappan, T. Zimmermann, and D. Lo. Understanding the test
automation culture of app developers. In IEEE 8th International Conference on Software
Testing, Verification and Validation (ICST), pages 1–10, IEEE, Piscataway, NJ, USA, 2015.
30. Y.-D. Lin, J.F. Rojas, E.T.-H. Chu, and Y.-C. Lai. On the accuracy, efficiency, and reusability
of automated test oracles for android devices. IEEE Transactions on Software Engineering,
40(10):957–970, 2014.
31. Y. Liu, C. Xu, and S.-C. Cheung. Characterizing and detecting performance bugs for
smartphone applications. In Proceedings of the 36th International Conference on Software
Engineering, ICSE 2014, pages 1013–1024, ACM, New York, NY, USA, 2014.
32. K. Mao. Towards realistic mobile test generation. In Proceedings of the 2016 International
Symposium on Software Testing and Analysis, ISSTA 2016, ACM, New York, NY, USA, 2016.
33. K.M.M. Linares-Vásquez, C. Bernal-Cárdenas and D. Poshyvanyk. How do developers
test android applications? In Proceedings of the 33rd International Conference on Software
Maintenance and Evolution, ICSME 2017, Shanghai, China, 2017.
34. A. Méndez-Porras, C. Quesada-López, and M. Jenkins. Automated testing of mobile
applications: A systematic map and review. In Ibero-American Conference on Software
Engineering, Lima, Peru, 2015.
35. N. Mirzaei, H. Bagheri, R. Mahmood, and S. Malek. SIG-Droid: Automated system input
generation for Android applications. In IEEE 26th International Symposium onSoftware
Reliability Engineering (ISSRE), 2015, pages 461–471, IEEE, Piscataway, NJ, USA, 2015.
36. Mockito. Company website: http://site.mockito.org/ [Accessed February 19, 2018].
37. Monkey. Project website: https://developer.android.com/studio/test/monkey.html [Accessed
March 5, 2018].
38. Monkeyrunner. Project website: https://developer.android.com/studio/test/monkeyrunner/
index.html [Accessed February 27, 2018].
39. H. Muccini, A. Di Francesco, and P. Esposito. Software testing of mobile applications:
Challenges and future research directions. In 7th International Workshop on Automation of
Software Test (AST), pages 29–35, June 2012.
40. M. Nagappan and E. Shihab. Future trends in software engineering research for mobile apps.
In IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering
(SANER), volume 5, pages 21–32, IEEE, Piscataway, NJ, USA, 2016.
98 ◾ Mobile Apps Engineering
61. Y.A.Y. Wang. Mobile security testing approaches and challenges. In First Conference On Mobile
And Secure Services, February 19–21, 2015, Gainesville, Florida, February 2015.
62. S. Yoo and M. Harman. Test data augmentation: generating new test data from existing test
data. Centre for Research on Evolution, Search Testing (CREST) King’s College London,
Technical Report: TR-08-04, 2008.
63. T. Zhang, J. Gao, J. Cheng, and T. Uehara. Compatibility testing service for mobile applications.
In IEEE Symposium on Service-Oriented System Engineering, pages 179–186, IEEE, Piscataway,
NJ, USA, 2015.
Chapter 4
CONTENTS
4.1 Introduction 102
4.1.1 Motivation 102
4.1.2 Technical Context 102
4.2 Requirement Elicitation 103
4.2.1 Requirement Elicitation 103
4.2.1.1 Observation 103
4.2.1.2 Interview 103
4.2.1.3 Questionnaire 104
4.2.2 Functional Requirements 104
4.2.3 Nonfunctional Requirements 104
4.2.4 Functionality to be Realized 105
4.3 Design and Implementation 105
4.3.1 Design 105
4.3.1.1 User Interface Design 105
4.3.1.2 Business Logic Design 107
4.3.1.3 Algorithm Design 110
4.3.2 Implementation 111
4.3.2.1 Front-End Application 111
4.3.2.2 Back-End Implementation 119
4.4 Results and Discussion 122
4.4.1 Results 122
4.4.2 Discussion 122
4.4.2.1 Testing and Modification 122
4.4.2.2 User Reviews 123
4.5 Conclusion and Further Work 123
4.5.1 Conclusion 123
101
102 ◾ Mobile Apps Engineering
4.1 INTRODUCTION
The City Tour app is inspired by the Uber app, which provides a successful e-commerce
platform that caters to the taxi trade whereby any registered private driver can be a taxi
service provider to meet the rider’s requirements. This app focuses on implementing an
Android application to fulfil requirements within this context and adds more functions
for tourism. The app allows a user to publish a request consisting a tour plan and wait for
a local driver who can offer a ride as well as make suggestions for this trip. Optimizing the
route and optimal price calculation are fundamental to achieving this. The app contributes
to travel intelligence and the sharing economy, providing business opportunities for both
tourism and the taxi industries.
4.1.1 Motivation
The quick, reliable, and cheap chauffeur car service is one of the most popular services and
it provides many potential business opportunities. However, contemporary services do not
take into account specific requirements of tourists. For instance, as reported by Sri Lanka’s
DailyFT [23]), 31.5 million tourists visited the city of London in 2015, a number expected
to grow significantly. This huge number of tourists visiting represents an extraordinary
user-base and potential business opportunities, and therefore an app targeted at these
users has the potential to benefit many tourists and transform the rules of the taxi and
tourism industries.
Mirroring the historical local guide, this project aims to design and implement an
e-commerce platform that enables users to travel in comfort, helping them to generate an
optimal route, a reasonable price, and an option to do a trade by offering a personalized
tour service. Furthermore, we envisage that the underlying algorithm has the potential
to be enhanced with machine learning and larger datasets to achieve travel intelligence.
Travel intelligence has a focus on the creation of value from data and it has already become
immersed in modern life. For example, Airbnb landlords can use a dynamic pricing model to
predict the probability of renting out their house at a certain price. Similarly, Uber analyzes
traffic data to predict, for example, whether the user will be late for a lunch appointment.
4.2.1.1 Observation
To design an appropriate interface for the City Tour app and understand the users’ requirements,
four popular taxi and tourism apps were studied and compared. Those apps are fully integrated
solutions that include functions necessary either to take a ride or to plan a trip. But none of
them provides a full solution to this project; thus the observation aimed to identify the parts so
as to be able to extend beyond them. Table 4.1 shows a comparison among those apps.
4.2.1.2 Interview
Personal interviews were employed as part of the requirement elicitation methodology.
Within this context, 10 people were directly contacted in face-to face interviews to investigate
a customer-centric view on overall design. The interviewees were either interested in
traveling or frequent users of taxi apps. One-to-one interviews about the trip app, taxi
app and their thoughts and suggestions were important for this project. The interview
Uber Taxi app Develops, markets and operates the Does not offer a plan for tourists new
Uber car scheme. Uber drivers use to a city, and the user can only select
their own cars or rent a car to offer a a specific destination and a specific
ride to users. starting point.
DiDi Taxi Taxi app Adds more types of cars than Uber. A Lacks tourism features but offers a
particular type is “hitchhiking” which way to combine two roles in an app
is more related to this project. that is implemented in our City
Tour app.
Airpano Tourism app Implements all the functions for high More functions can be identified
comfort with high-quality relating to tourism by referencing
introduction and pictures about this app, such food and place
destinations. introductions.
Ctrip Tourism app Provides tourists with functions Top 10 destinations in the city are
relating to hotel and ticket ordering, identified and this project adds a
and has detailed information about function termed “personal requests”
each destination. by which users can click
destinations from what the app lists.
104 ◾ Mobile Apps Engineering
questions mainly focused on what kind of service the users want to receive from such an
application. It was concluded from the interviews that apart from the reliability and basic
functions of the app, users most wanted an app that could guide them in a new city with an
easy-to-use user interface. This requires that the app’s activities are well organized without
any complexity in operation. The simplicity of the app, to some extent, contributes toward
the reliability. Also, more “clicks” should be made instead of “choices” in this project, as
according to the interviews it is more convenient for users to make a decision instead of
reading introductions of each choice in detail.
4.2.1.3 Questionnaire
Another instrument used to collect user input in this project was questionnaires. The
questionnaire was designed to collect possible requirements regarding functionality and
user interface design. Overall, the questionnaire consisted of 15 questions and 92 feedbacks
were received. As the outcome of this exercise the following points were concluded: First,
basic functions such as publish a request, get a ride offer, manage the routes, calculate the
corresponding price, and offer tourism information are necessary. Second, when the driver
accepts the offer, the status in the user side should change. Third, the user needs to be able
to select the mode of publishing a ride—either by entering the destinations they know or
by clicking a destination that is popular in the city. In addition, more than half of the users
(72.2%) think that a bright color will be more suitable for this app as it makes people happy
and this is important during traveling. Finally, flexible software interfaces with functions
compatible with different operations are essential.
1. Both the rider and the driver can publish a request and see available requests, and the
driver can offer a ride with a corresponding price, after which the route displays on
the main page.
2. The rider can select a mode to publish the request—either selecting the destinations
from 10 places or searching the destination and entering it.
3. The plan displays after the rider selects the destinations, starting time, end time, and
the number of people.
4. When the driver accepts a ride, the status in the rider side will change accordingly;
and before that the rider can cancel the ride.
5. The rider can look for local entertainment, weather information, and places nearby.
• The application should be developed with a database, for example, JDBC (Java Database
Connectivity) to connect the server and database and MySQL database.
• Usability: The user interface should be easy for new users to use even without a user
manual.
• Flexibility: The app is intended to be able to adapt to continuously changing
requirements.
• Reliability: The app should have error messages when users have error operations.
• Privacy: The system cannot disclose the personal information of the driver or the rider.
of both ease of customer requirements and technical implementation, thus optimizing the
overall design. A major change is to transform from two separate applications—one for
trip drivers and the other for tourists, with separate login and business logic—to two roles
in a single app. Each login requires a judgment, and subsequently different interfaces will
display. Although this is a challenge for both the performance of the app and mobile phone
resources, considering the large overlapping functions of both roles the two sides require
almost the same functions. The driver can be a tourist in a new city and act as a tour guide in
his or her own city, just as with Airbnb the lessor and the occupants need a flexible exchange
of both roles. Thus we transformed this application into a single app and the two roles can
be switched. Figure 4.3 shows the view of role selection in this app.
1. Rider: A rider can request a ride while looking at current location (which is updated very
frequently) on a map. Once the rider clicks the “Request Ride” button, the request is
stored on the online database. The rider also has the option to cancel the request, which
will in turn remove it from the database. Any drivers can see the request from riders.
2. Driver: A driver can view available requests from other riders displayed in an Android
ListView, which is a vertical table with clickable elements. The requests ordered on the
basis of time. Once drivers click on a request, they can accept it or look for another
one. Accepting the request brings up a navigation view of the whole route as well as
the price view of this ride.
The user requirements are then conceptualized, and the user interface design prototype
and optimization is made by the Prototyping on Paper (POP) app, which helps to generate an
interactive user interface. Table 4.2 shows the steps of user interface design and optimization.
The resources used to improve the UI design include Material Design of Google, the
Dribble website, and the open resource widgets in Github. The whole process begins from
designing the home page, making choices among different kinds of menus and buttons,
and selecting the mainstream color to coding the component layouts. The final part was to
code several layout designs using XML and make links between different pages using Java,
whose main steps are selecting views, positioning views, and styling views.
3-month layout
optimization
available ride. To publish the need, there are two modes: the user could generate his or her
own plan (normal mode) or use this app to generate a trip plan (personal mode). In normal
mode the logic is the same as a classic taxi app. In personal mode the app asks for the starting
point, destinations, time, and the number of people, then the next page will show the plan
generated by the app, consisting of the order of destinations, visiting time, driving time, and
time of arrival at each destination; the last page asks whether the user accept this plan and,
based on the user’s answer, it will either show congratulations or redirect to the previous page.
To summarize, the business logic is as follows:
1. The user is allowed to create a list of places (or point of interest) with priorities; the
City Tour app can generate an optimal route and calculate the cost of travel based on
distance, time, labor, etc.
2. Publish this as a request to the registered private drivers/tour operators as a potential
trade deal.
3. The registered private drivers/tour operators can generate a suggested tour with a
fairly calculated cost.
4. Advertise to users.
City Tour App ◾ 109
start
register/log in
role:
Driver/User driver/ Driver
rider?
Driver/User Driver/User
Publish a
request
Y
Y
N
View related view kind of entertainment
places the local area
calculate the
take the request
price and the
and offer a ride
route
accept?
finish
• Increasing the number of people and the distance between destinations from the
request publishing page increments the price for that trip.
• Specific formats of the rider’s destinations, mobile phone number, the number of
traveling days and other personal information must be followed.
• A specific internet protocol and a format of data for communicating with the back-
end server.
110 ◾ Mobile Apps Engineering
4.3.1.3.1 Price Calculation Algorithm Design In the design of this algorithm, four factors
were considered and the price is calculated based on Equation (4.1):
1. Ride time (distance). As well as the distance, the ride time (duration) should also be
a factor in calculating the final price. Initially the price is automatically calculated
based on GPS positioning and street data; then, with some alterations to the
traditional algorithms, it will be adjusted according to the time commonly used to a
specific distance. This is the most critical difference with the ordinary taxi service—
the passengers pay a price that is based on the time spent rather than only on the
distance.
2. Traffic. The traffic conditions can affect the length of time taken; that is, the price will
be adjusted according to the level of traffic. When the traffic is busy, a journey of the
same distance will take longer time. This pricing strategy will encourage drivers to
offer ride to passengers in peak time, and at times of low demand the drivers can stay
at home. Uber patented this pricing strategy based on a large dataset, also known as
“peak pricing strategy.” It is also termed “dynamic pricing”; this is very similar to the
on-demand pricing used by chain hotels and airlines, but Uber’s implementation is
more complicated, not simply raising prices on weekends or public holidays but using
forecast models to evaluate real-time requirements.
3. Particular time. When the trip request is started at peak time in the morning or in the
afternoon, the price will be higher than normal. For example, at 8 a.m. there is high
volume of traffic and the driving time will be much higher than it is one or two hours
later. Increasing the price is reasonable because the ride time will be increased and
thus the fuel cost will increase.
4. Special days. The demand will vary on different days. For example, during Christmas,
the trip demand will be much higher than usual. Similarly, imagine the end of a
concert late in the night when buses are no longer in service and at a time when car
services are in short supply. This will trigger the price to rise, which is good as the
price drives the balance of supply and demand. Thus, when the user’s waiting time
appears relatively steep, it will engage the price increase algorithm. Most of these cases
are predictable, such as around holidays or certain annual concerts and events.
City Tour App ◾ 111
4.3.2 Implementation
The technical components are implemented as APP–Server–Database as presented in
Figure 4.5.
The android app sends an HTTP client request and receives a response from the server,
and the server connects to the MySQL database, which will return to users whatever they
request and display the results.
We use Android Studio as the integrated development environment (IDE) for Android
application development, MyEclipse to develop the back-end server, and MySQL as the database.
4.3.2.1.2 Login & Logout/Home Page Figure 4.6 shows screenshots of login–logout and
home pages. Before entering the home page, the user needs to either login in or register. After
the user enters the required information, a validation function named validate() will be used
in logging in and registering. If all the fields are filled both correctly and completely, then the
data will be sent in JSON (JavaScript Object Notation) format to the back-end database to be
stored. For instance, if the user uses an invalid phone number or leaves a blank, then an alert
dialog will display. Next time, a registered user could simply log in with correct information
and enter to the home page. There are three activities responsible for this:
• ActivityLogin
• ActivityRegister
• MainActivity
112 ◾ Mobile Apps Engineering
in the project to set the permissions and the key. In the home page, different view will be shown
in different roles (“rider” or “driver”). This is achieved by a variable called type that is stored
in the database. On identifying the number of the type, the app will display different views.
4.3.2.1.3 Publish a Request The user can choose to publish in the normal way or in a
personal way (shown in Figure 4.7).
In personal mode, there is a list showing the user 10 destinations popular in the relevant
city. This is achieved by ListView which is a view group displaying a list of scrollable items.
The user can scroll the view and select the destinations he or she wants.
In the “adapter” directory, there are Java files responsible for creating “adapters,” as
shown in Figure 4.8.
The adapter Java files act as adapting data resources and ListView, transforming the data
into a format that ListView can display (by attaching the adapter to the ListView).
The efficiency of adapters is enhanced by making use of ListView’s cache and imple-
menting the ViewHolder class to display the cached contents, which avoids calling meth-
ods to find widgets in many times. The main steps are as follows.
Then a user needs to enter the destinations or starting point. InputtipsActivity is added
to help the user find the destination more efficiently and conveniently.
This activity is called when the user need to find the places at which to start and end.
It helps the user to find the place more quickly and more efficiently. When something is
entered, the onTextChanged() function will be called; the application will then query the
online server for results. After getting the results, it will handle the results and display
on the page, adding the city and the district of the destination. For example, if the user
chooses to go to a “fancy” place in Haidian District, Beijing, he or she only needs to enter
“f” and look for “fancy” in the list; when the user chooses it, the app will identify the
district and city automatically. This will be then stored in the database and listed in the
available rides.
The data structure HashMap is used to store information on destinations from the
database. The Tip object is offered by AMAP API, which can be used to get the detailed
information on a specific address including the district, the city, its latitude/longitude, etc.
When the user confirms the chosen place, it will send it to the former activities and this
will be used in the following activities as important data.
After publishing the request, the data will be stored in the RequestVo object, which will
be sent to the server and stored in the database. The next time the user looks at this page,
he or she is able to see all published requests in a scrollable list.
To achieve this, the AsyncTask class is used. This puts the preparation work in the main
thread inside the implementation of the onPreExecute() method, and the doInBackground()
method will be implemented in the work thread to deal with those heavy tasks. Once the
task is finished, the onPostExecute() method is called to return to the main thread. Thus we
City Tour App ◾ 115
can make interaction between back-end thread and UI thread/main thread. In this case, the
tasks communicating to the server can be seen as a heavy task, which is time-consuming;
when this operation is finished, we can change or generate new layouts to identity that this
task is over. Otherwise, it will cause unexpected errors if we execute some other tasks before
the connection work is done (shown in Figure 4.9).
In detail, for the implementation of AsyncTask there are three important parameters:
Params is a required parameter for the background thread. In order to make the
background thread work, some necessary parameters need to be offered; for example, for
the downloading of a picture, the parameter can be the picture’s download address. Progress
is the progress of the background-thread processing job such as how much the downloading
task is completed—20% or 80%, and so on. This number is provided by Progress. Result is
the result after running the background thread, that is, the information that needs to be
submitted to the UI thread—the picture in this example.
4.3.2.1.4 See Available Requests/Take a Ride To get the request information, AsyncTask is
also used similarly to adding the data into the database, but in a different direction—from
database to Android application.
Figure 4.10 shows screenshots of looking at available requests and taking a ride. When
the user clicks the “see available” button on the home page, he or she can see the available
requests from people in other roles. For example, if you are a driver, you could see only
requests sent by riders. This is achieved by the “type” global variable, which was explained
in an earlier subsection.
The user can also see his or her own requests with corresponding status on the Publish
page; if the user clicks on a request, the details of the request will display. Then the user
can choose to cancel the request or return to the previous page. To implement this,
ActivityDetail lets the user see all the current requests from other riders and drivers
concerning the available rides by using AsyncTask.
The user can simply choose an available ride set by the driver and not publish a new one.
If the user plans to accept the ride, he or she just click the “accept” button and this will
116 ◾ Mobile Apps Engineering
trigger the “status” variable of the request to change. The update of the request status will
be seen by users in both roles.
4.3.2.1.5 Start a Trip If the driver accepts a ride, there is a major divergence. The driver can
then click the button “start the ride” on the home page and the app will:
This is implemented by AMAP Navigation SDK and MSC SDK, one for the navigation
function and the other for the voice guide function. Using them is the same as described
previously: get the key from the official website and then add the necessary files into the
development environment. First, AMapNaviView is defined in the layout file using XML,
which displays the navigation view for the user. Second, to ensure the correct display of
this navigation view, the implementation life circle is in Activity_navi, and in each step
of the life circle, different methods will be implemented to ensure the correctness of the
logic. After that, the driving route calculation is implemented. There are many strategies
for calculating the route; that of avoiding congestion is selected because according to the
questionnaire the traveling time is always valued by tourists. To achieve this, there are five
parameters in calculating the route in the strategyConvert() method:
1. Avoid congestion.
2. Avoid highway.
3. Avoid cost.
4. Highway.
5. Multiple routes.
Setting false means not considering this specific strategy. For example, if the developer
sets the second parameter to false, it means that he or she does not need to calculate a route
avoiding highways. It is very easy to change the strategy subsequently.
Finally, after successfully calculating the route, a callback function is called and starts
the navigation.
The parameter NaviType.EMULATOR is to identify the type of the navigation; it is
chosen to use emulator mode because this is convenient to show the functioning of the app.
Otherwise, if we remain in a location, the navigation will not continue because we could
not move as far or as fast as a car.
4.3.2.1.6 Price and Route Calculation/Tour Plan View After the user selects the destination
and fully fills in the required information, the price and the route will be shown on the
page, as illustrated in Figure 4.12.
The price calculation is similar in the two modes; however, in normal mode the route is
fixed—from the starting point to the destination. In the personal mode, the route algorithm
will be used to calculate a more efficient route for the user, which is explained in detail later.
DestinationActivity and PlanActivity are responsible for implementing this function,
one for getting the necessary information and calculating the price and route, and the other
for displaying the route and price for the user.
In calculating the price, the time, date, number of people, and places are used. The related
data is obtained from user input. Those fields will be complete as there is a verification
function to ensure it; otherwise, the user cannot move to the next page. We set the starting
price to be 3 yuan and 2.3 yuan per kilometer, which is an average price for taxis.
The price calculation also considers the number of people, since when the weight of the
vehicle increases, the fuel cost will be higher. The date and the time will be other factors to
include in the calculation of the price. For example, at 8.am and 6.pm (peak hours), an extra
5.5 yuan is added, which is just an estimated increase; on Christmas, Valentine’s Day, May
Day, and the like, the price will also increase, by different amounts.
In personal mode, the route calculation will be an important task. After the user selects
some destinations, an ArrayList will store the selected destinations (identified by their
IDs), and several HashMaps will store the information of the destinations. The information
items on destinations is recorded in the SQLite database, such as their priority, longitude,
latitude, name, etc.
In the first place, the priority and the location of the selected destinations will be
obtained and stored in the corresponding HashMaps. This is to calculate the weight of
each destination in order to make a route plan. AMAP API is used to obtain the distance
of each path. With the priority number set in the database, the weight is obtained.
Then, with the use of the Ant Colony algorithm and the Dijkstra algorithm, the route is
obtained and the order will be stored in an ArrayList called “ordernum”.
Next, after obtaining the order of destinations, the visiting time and driving time of each
destination are calculated. The driving time is an estimate ride time based on the distance
and the average car speed. It is true that the time can be established more accurately by
implementing a specific algorithm, but it is not the main focus of this project, so this app
uses the estimated time. To calculate the visiting time, the priority of the destination is
used. This is based on the percentage of the overall priority. Note that in order to calculate
the visiting time of each destination, an upper limit and floor limit are set, which here are
3 hours and half an hour, respectively. The plan list can then be generated. In summary:
the total visiting time is calculated from the input of users. The user will give the start time
and end time of a day, as well as the starting date and how many days he or she would like
to stay. The plan list will then be calculated based on this, including the visiting time of a
specific place, the order of the plan and the time of arrival of each place.
4.3.2.1.7 Explore the City Other functions are added for the user to explore the city
including the food, weather, places nearby, etc. (as shown in Figure 4.13).
Activities include: PoiAroundSearchActivity, ActivityTravel, ActivityFood, and
WeatherActivity. These are activities responsible for extra tourism activities. For example,
City Tour App ◾ 119
in PoiAroundSearchActivity, the user can select a specific place and the application will
display the top 10 related places nearby based on the information the user gives. This is
implemented using AMAP API, firstly initializing the map, then calling query functions
and getting the results from the map server, and finally displaying the results on the map.
Also (e.g. in ActivityTravel, ActivityFood, WeatherActivity), a real-time weather
searching function and multiple entertainment functions are added to allow users to enjoy
the city tour more deeply. For example, added sensor functions include a light sensor, an
acceleration sensor, and an orientation sensor. This is implemented using SensorManager,
which is the manager of all sensors in an Android system. Application can get any sensor
by calling getDefaultSensor() methods.
With the “camera” function, users would be able to take a picture and crop it to the size
of their preferences. This might be extended further into two parts:
These features are not the main focus of this chapter, and are not yet fully developed, and
so will not be considered in detail.
1. Layering: the underlying data logic and the high-level business logic layer are layered
in order to achieve decoupling. Figure 4.14 shows an overview of DAO design pattern
using in this project.
2. Data encapsulation: that is, the data transfer object in DAO components.
DAO design pattern is very important for the implementation of the back-end system,
which is actually a combination of two modes, the Data Accessor mode and the Active
Domain Object mode. Data Accessor mode is to achieve the separation of data access and
business logic; Active Domain Object mode is to achieve the encapsulation of the business
data object. The DAO design pattern is a design pattern in Java EE.
DAO has several important components:
that is also a powerful JavaEE integrated development environment, offering support for
code preparation, configuration, testing, and debugging. Tomcat is a JSP/Servlet container,
the use of which is suitable for small and medium-sized applications; it is therefore it is
suitable for this project.
The architecture of the back-end server is shown in Figure 4.15. The server uses Java EE
hierarchical structure, dividing it into view layer, controller layer, business logic layer, and
DAO layer. The hierarchical system puts business rules and data access into the middle
layer processing. That is, the client does not interact with the database in a direct way but
through the controller as well as the middle layer to set up a connection. The middle layer
then makes an interaction with the database to access the data.
The servlet class in the server is responsible to response to user requests, getting request
parameters and calling business logic layer to handle the requests. Based on the handling
results, it will generate the output back to the application and send the encapsulated data
in JSON format. In short, the servlet layer does not enter anything or do any processing but
is only responsible for receiving, in this project, HTTP requests from the client. It decides
which model to call to handle requests, and then determines which data to return.
The server is identified by URL. We choose to use the common approach of REST
(representational state transfer) web services. The application makes HTTP requests to
the server, sending and receiving data in JSON format. The data will be stored in an entity
object and there exits one class in both Android Studio and MyEclipse, which helps to parse
JSON. Once the server gets the data, it will parse it and then makes queries to the database,
responding to the application after getting the results. This is achieved by JDBC, and we
will explain it in the next section.
There are two very common formats for transferring data on the network, XML and
JSON. The main reason we choose JSON is that it is smaller and more readable on the
network. There are many ways to parse JSON data; we choose to make use of Google’s open
source library GSON, which can automatically map a JSON-format string into an object, so
this project does not need to manually write Java code to parse the data.
122 ◾ Mobile Apps Engineering
In addition, there are two kinds of tool classes in the server side, one for data storage and
the other for encapsulating the data into JSON format. Finally, the web.xml file should be
deployed to make the server work.
4.4.2 Discussion
4.4.2.1 Testing and Modification
The application was tested constantly during the implementation phase. The purpose was
to find errors and bugs and to solve them so as to make the app more reliable. For Android
applications, it may run on various devices so it is important to test on different devices.
The application was first tested in devices with lower configurations and then on devices
with higher configurations (e.g., screen resolution, to ensure that is will work adequately
on different Android mobile phones).
The test then focuses on the business logic of the application; this project breaks down
the test into three parts:
The functional tests are based on black-box testing to verify functionality according to
the specification. Table 4.3 shows the test cases of the application.
One main error occurs during testing phases, which is the synchronization problem. To
send the data to and get the data from the database, the thread needs to perform some time-
consuming tasks and will block the UI thread that displays the page for the users. Therefore,
we add an inner class which extends AsyncTask to solve this problem.
calculation algorithm is based on the Dijkstra algorithm with some alterations. The price
calculation algorithm considers four factors including distance, traffic, special time, and
special days. With further development the project will optimize these algorithms and the
distribution of the visiting time for each destination. This project has followed UI design
based on the responses from interviews and questionnaires to complete the links among
different pages and during development continually improved the UI design to make the
app more attractive and user-friendly. In addition, the app has some extra functions more
appropriate to tourism, such as point of interest search and route navigation.
relationship between the input variables and the single output variable. It would be
supervised learning for, in this project, ride pricing. Numerous techniques exist because the
model has been extensively studied. According to the Machine Learning Mastery website
[22], “learning a linear regression model means estimating the values of the coefficients
used in the representation with the data that we have available.”
This project has already found a way to implement the machine learning method by using
Weka, Java library, which provides machine learning algorithms for tasks this project needs to
handle. The algorithms can either be applied directly to a dataset or called from the Java code.
A main advantage of machine learning algorithms is that the accuracy increases as the
amount of data to learn from increases, which suits the purposes of this project. Also, both
methods will double the resource utilization, which is undoubtedly a benefit to overall
optimization. For example, the priority rating of each location is set in the database instead
of being dynamically generated or updated over time. However, this can be improved
by using online ratings data from well-known and well-used travel websites or updated
according to machine learning algorithms. As the data is growing, the planning can be
generated by supervised or unsupervised learning based on machine learning algorithms,
and even the algorithm itself can be chosen using other algorithms. Data is like a gold-mine
that will help us to explore the world further.
BIBLIOGRAPHY
1. Griffiths, D., and Griffiths, D. 2015. Head First Android Development. O’Reilly Media, Inc.,
Newton, MA, USA.
2. Hamilton, G., Cattell, R., and Fisher, M. 1997. JDBC Database Access with Java (Vol. 7). Addison
Wesley, Boston, MA, USA.
3. Chi, Z. 2016. China’s Tourism Statistics Bulletin 2015. Retrieved January 24, 2017, from
China National Tourism Administration. http://www.cnta.gov.cn/zwgk/lysj/201610/
t20161018_786774.shtml
4. Android Official Guide. 2016. Official Guide for Android Development. Retrieved October 21,
2016, from Google Android Developer: developer.android.com
5. Ouyang, H., Xie, Z., Huang, S., and Ding, Y. 2009. A data persistence layer model based on
DAO design pattern and hibernate framework. Microcomputer Applications, 3, 36–40. doi:
10.3969/j.issn.2095-347X.2009.03.008
6. Kwak, D., Kim, D., Liu, R., Nath, B., and Iftode, L. 2015. DoppelDriver: Counterfactual
actual travel times for alternative routes. In 2015 IEEE International Conference on Pervasive
Computing and Communications (PerCom), (pp. 178–185). IEEE, Piscataway, NJ, USA.
7. Romeing, H. 2015. UberTOUR: Sightseeing The New Way. Retrieved October 12, 2016, from
Romeing: http://www.romeing.it/rome-ubertour-sightseeing.
8. Li, Z., Zhu, Y., and Li, M. 2009. Practical location-based routing in vehicular ad hoc networks.
In IEEE 6th International Conference on Mobile Adhoc and Sensor Systems, 2009. MASS’09,
(pp. 900–905). IEEE, Piscataway, NJ, USA.
9. Smirnov, A., Shilov, N., and Gusikhin, O. 2016. “Connected Car”-based customised
on-demand tours: The concept and underlying technologies. In International Conference on
Next Generation Wired/Wireless Networking, (pp. 131–140). Springer International Publishing,
Cham, Switzerland.
10. AMAP Official Guide. 2015. Using AMAP API for Android Development. Retrieved October
27, 2016, from AMAP API: http://lbs.amap.com/api/android-location-sdk/locationsummary
126 ◾ Mobile Apps Engineering
11. Zapata, B. C. 2013. Android Studio Application Development. Packt Publishing Ltd.,
Birmingham, UK.
12. Chang, W. C., Tai, H. T., Hsieh, D. L., Yeh, F. H., and Chang, S. H. 2013. Design and
implementation of the travelling time- and energy-efficient android GPS navigation app
with the VANET-based A* Route Planning Algorithm. In 2013 International Symposium on
Biometrics and Security Technologies, Chengdu, China (pp. 85–92).
13. Liu, S., Leng, H., and Han, L. 2017. Pheromone model selection in ant colony optimization for
the travelling salesman problem. Chinese Journal of Electronics, 26(2), 223–229.
14. Zheng, J. J. 2016. Navigation from one place to multiple destinations for the best route. Retrieved
March 25, 2017, from Wan Fang Data Library: http://g.wanfangdata.com.cn.
15. Rani, C. R., Kumar, A. P., Adarsh, D., Mohan, K. K., and Kiran, K. V. 2012. Location based
services in android. International Journal of Advances in Engineering & Technology, 3(1),
209–220.
16. Bender, M., and Westphal, S. 2015. An optimal randomized online algorithm for the
k-Canadian Traveller Problem on node-disjoint paths. Journal of Combinatorial Optimization,
30(1), 87–96.
17. Yurchak, W., and Dudas, V. 2017. Investigation into applicability and efficiency of SQLite for
implementation of Dijkstra’s algorithm. In 2017 14th International Conference The Experience
of Designing and Application of CAD Systems in Microelectronics (CADSM), Lviv - Polyana,
Ukraine, (pp. 282–284).
18. Welling, L., and Thomson, L. 2003. PHP and MySQL Web Development. Sams Publishing,
Carmel, IN, USA.
19. Monseul, M. 2016. An Implementation of Ant Colony Optimization for TSP problem in Java.
Retrieved March 12, 2017: http://blog.csdn.net/wuchuanpeng/article/details/51583829
20. Saini, L. M., Aggarwal, S. K., and Kumar, A. 2010 January. Parameter optimization using
genetic algorithm for support vector machine-based price-forecasting model in national
electricity market. Generation Transmission & Distribution IET, 4(1), 36–49.
21. Guo, L. 2014. The First Line of Code: Android. The People’s Posts and Telecommunications
Press, Beijing, China. In Chinese.
22. Brownlee, J. 2013. A tour of machine learning algorithms. Machine Learning Mastery. Retrieved
January 11, 2016, from Machine Learning Mastery: http://machinelearningmastery.com.
23. Daily FT. 2016. London sets record with over 31.5 million visitors in 2015. http://www.ft.lk/
article/543880/London-sets-record-with-over-31.5-million-visitors-in-2015
Chapter 5
CONTENTS
5.1 Introduction 127
5.2 Related Work 128
5.3 Edugames4all MicrobeQuest! 129
5.3.1 Edugames4all 129
5.3.2 Software Development Life Cycle 130
5.3.2.1 Inception 130
5.3.2.2 Design 130
5.3.2.3 Development 131
5.4 Stabilization 134
5.4.1 Participants 134
5.4.2 Set-Up 134
5.4.3 System Usability Scale 135
5.5.4 Observations and Focus Group 135
5.5 Summary 135
References 135
5.1 INTRODUCTION
Serious games and gamification have been identified as one of the main challenges of
current pursuit in digital health [17]. Educational games that teach through the mechanics
of the game have been evaluated as an effective educational intervention [40]. However,
designing games aimed at children has its own challenges and issues [30].
127
128 ◾ Mobile Apps Engineering
Raising the awareness of and better public and professional education about the global
challenge of antimicrobial resistance is one of the goals in attempts to reverse this dangerous
global trend of growth in resistance [24]. Public attitudes towards prescribing are seen as
an important factor in antibiotics overprescribing [7] that could be changed by targeted
internet websites such as Bugs and Drugs [22] and Do Bugs Need Drugs? (http://www.
dobugsneeddrugs.org/).
However, targeting children is of particular importance. Teaching hand and respiratory
hygiene to reduce illness (which that could potentially require antibiotics) among children
has proved to have strong impact on children’s health and school absences [11,39] as they
will educate the future generation of antibiotics users.
This chapter will present a mobile game that it is aimed at 9- to 12-year-olds
and teaches about healthcare issues based on the core concepts from the European
curriculum [21]. It will expand on the implementation challenges of developing and
porting a mobile game compared with a previous desktop-based solution [31]. It will
discuss the learning objectives covered in the game and how they have been integrated
into the game mechanics to enable assessment through the method of “seamless
evaluation”. The chapter will also present the results of a study assessing the game’s
usability.
Technically we will present the issues encountered while developing a mobile game as
opposed to a desktop-based game and how they have been addressed. Most of these issues
are not unique to our application and our approach could be useful for other projects. We
also consider how the learning objectives could be integrated into the game mechanics,
which could be relevant for other serious games projects.
There is indeed potential for applying interactive storytelling to learning [15]; however,
evaluation of the educational impact of the game against a set of learning objectives (LOs)
remains a challenge.
The effectiveness of serious games in terms of learning outcomes is still understudied,
mainly due to the complexity involved in assessing intangible measures [3]. To assess the
educational impact of games, novel approaches are required that fully take advantage of
the interactive environment and game mechanics while not decreasing user immersion and
engagement with the game. In-game interaction data have been used to improve assessment
of a game in the eAdventure platform [38].
To make full use of the in-game data, an integration of the LO evaluation into the game
mechanics—the so called “seamless assessment” or “seamless evaluation” framework [28]—
has been developed and is in use. The games showed the ability to change based on the
improvement in student knowledge. Moreover, including the feedback of the assessment
in the score or the interactive digital storytelling reward system can act as an extrinsic
motivation for the players and increase enjoyment of the game. While the SUS (system
usability scale) score framework has been established in the domain for assessing usability
[2], an assessment of knowledge change and improvement throughout by seamlessly
collecting answers to questions in the game has been developed by Kostkova [16] and
Molnar and Kostkova [28]. The study of user engagement with digital health technologies
identified approaches to increasing user engagement with serious games while assessing
knowledge change and retention [18].
5.3.2.1 Inception
The addition of a mobile version of the game was motivated by children’s increased access
to mobile devices. Edugames4all MicrobeQuest! was developed as a mobile version of one
of the edugame4all platform games. The game has several missions, with each mission
focusing on one aspect of three themes: microbe transmission, food and hand hygiene, and
responsible antibiotic use. Each mission focuses on a certain environment: hands, food,
or body. To see the microorganisms, in some missions, the player shrinks to the size of
a microorganism and explores the environment. The learning objectives covered in the
game along with the environment in which the learning objective is presented are shown
in Table 5.1.
As with previous games, the learning objectives covered in the game are based on
learning objectives taught across several European countries. The learning objectives aim
to familiarize the children with microorganisms, their transmission, their role in hygiene,
and the importance of using the antibiotics only when and as prescribed by the healthcare
professional.
5.3.2.2 Design
The game design is based on the desktop version of the game and follows relatively closely
the desktop version of the platform games [31]. Prior to development of the desktop version
of the game, design focus groups were held with primary school children to determine the
type of game most suitable for this age group [8]. From the results of the focus groups, it
TABLE 5.1 Learning Objectives Covered in the Games and the Environment They Relate to
Learning Objective Environment
Bacteria, viruses, and fungi are three different types of microbes Hands, Food and Body
Bacteria, viruses, and fungi can be found in different environments Hands, Food and Body
Bacteria, viruses, and fungi come in different shapes and sizes Hands, Food and Body
“Bad” microbes can make us ill Hands, Food and Body
Not all microbes are harmful Hands, Food and Body
Washing can eliminate harmful microbes Hands
Useful microbes can make food like yogurt (and bread) Food
Our bodies have defences to fight off disease Body
Antibiotics can be used to fight off bacterial infections Body
If antibiotics are taken, it’s important to finish the course Body
Vaccines can be used to obtain immunity to viral diseases Body
Vaccines can be used to obtain immunity to viral diseases where the body’s Body
natural defences alone are not enough
Bacteria are becoming resistant to many antibiotics due to antibiotic misuse Body
(not finishing the course)
Teaching Hygiene and Responsible Antibiotic Use through a Mobile Game for Children ◾ 131
was decided that platform games were the type that children enjoyed [8]. Furthermore,
other focus groups and observational studies were performed to validate the characters in
the game and determine what it is the best way to present the children the characters in
the games [8].
At the beginning of the game, the player will choose an avatar. Afterwards, in most
of the game missions, the player will shrink to the size of a microorganism and explore
different parts of the body or the kitchen. Through the interaction with the microorganism,
the player is taught several learning objectives that focus on microbial transmission, hand
and food hygiene, and antibiotic resistance. The learning objectives are taught through a
combination of text and game mechanics [29,34]. Our previous work [29] has shown that
it not always clear whether teaching with text or with game mechanics will produce better
results, and in this case we opted to use both approaches, one method reinforcing the other.
For example, teaching about the “good microbes” and some of their applications through
text is an example of the message provided by the game to the players: “Good microbes can
turn milk into yoghurt. That’s how yoghurt gets made. Amazing isn’t it?”. Through game
mechanics, the player must push a Lactobacillus bacterium into a glass of milk. When the
bacterium touches the milk, the milk becomes yogurt.
MicrobeQuest! allows measurement of the player’s knowledge before and after they
tackle the learning objectives through the game. Teachers and the players can thus
determine how much their knowledge has improved because of playing the game. The
assessment implementation is done through a quiz such as “How to be a millionaire”. The
learning objectives that are to be covered in the next levels are assessed at the beginning of
the game and no feedback is provided to the player whether their answers were accurate.
After each level, the learning objectives covered in the previous level are assessed through
the same quiz, but now the players are provided with feedback on their answers. Previous
research has shown that this kind of assessment does not affect how the players perceive
the game and most of the players preferred it as opposed to being assessed through a
questionnaire [19].
5.3.2.3 Development
To allow the game to be played across different platforms we used a hybrid approach in
developing the mobile game. During the process, we encountered several challenges specific
to the mobile version of the game [31] when trying to transform the desktop version of the
game into a mobile one.
First, mobile devices have a multitude of platforms with different requirements. A hybrid
approach to the development means making different trade-offs in terms of rendering and
graphics. For testing, we decided to focus on optimizing the application for one mobile
operating system—Android—as this is the most commonly used operating systems in
terms of internet usage [5] and can reach as many players as possible.
Second, the appropriateness of a development platform in the rapidly changing mobile
market remains a challenge. The desktop versions of the games were developed in Flash
due to the availability of the plugin on computer internet browsers in most schools [9]
at the time when the games were developed. However, mobile device support for Flash is
132 ◾ Mobile Apps Engineering
declining. As a result, it was not an adequate technology to use in developing the games
and especially games for mobile devices. As both the availability of HTML5 and JavaScript
and their capability is increasing along with support across different platforms we decided
to implement the games in HTML5 and JavaScript.
Third, for mobile applications small size is important due to the memory constraints
but also because of limited bandwidth available for mobile applications. When the desktop
application was built, we considered that the internet connection might fluctuate and
therefore tried to keep the size of the games small. Nevertheless, most of the assets still had
to be modified for the mobile device to keep the mobile application size light.
Fourth, the internet connectivity on mobile devices cannot be assured, and sometimes
users might have concerns regarding the data usage and the costs associated with it [26].
Edugames4all MicrobeQuest! uses internet connection only if the player explicitly agrees
to it when using the app (see Figure 5.1). The internet connection is used to deliver the
players’ scores and retrieve the other players’ scores, for the player to be able to compare
his or her performance with that of other players. The players’ score is transmitted to the
server only if the players agree to it. To allow this feature, when there is no available internet
connectivity, the scores are stored locally until the next time the player uses the game
and has an internet connection. This approach also allows users with no or limited data
plans over 3G and 4G protocols (common for children’s mobile use) to enjoy the gaming
experience without worrying about the availability of free Wi-Fi hotspots or other means
of affordable connectivity.
Fifth, mobile devices screen sizes vary, and different screen sizes would allow for a
different amount of information to be displayed. To avoid affecting the player experience
we used a “zoomed-in” approach for games played on small devices and “zoomed-out”
for games played on larger screens. Figures 5.2 and 5.3 present two examples where this
approach was implemented.
Table 5.2 presents a summary of the development challenges we encountered and a brief
description of how they have been addressed.
FIGURE 5.2 Player exploring the kitchen: game screenshot for 800 × 480 px device.
FIGURE 5.3 Player exploring the kitchen: game screenshot for 1280 × 720 px device.
5.4 STABILIZATION
In the stabilization phase we aimed to assess the usability of the system. We used mixed
methods to assess the usability of the game. System Usability Scale (SUS) [4] was used
to quantitatively assess the usability of the game, while observations were used to collect
qualitative data and further feedback. Observations could be used when observing a
phenomenon [25], in our case the participants playing the game. The observations were
done by the researcher who conducted the study.
SUS is a 10-question usability questionnaire used to assess and quantify perceived
usability. The questionnaire is reliable and has been validated [1]. It has been used in the
past to assess usability in different contexts, including games (see, for example, 12,33,35,42).
The original questionnaire was modified so that it was adapted to assess a game rather than
a system in general as described in reference [33]. The word “system” has been changed
to “game” and “use” changed to “play”. Moreover, some of the words were modified to be
suitable for participants in this age group. The final version of the questionnaire is presented
in Table 5.3. The SUS uses a Likert scale. The participants must select from a scale from
1 to 5, where 1 is labelled with Strongly Disagree and 5 is labelled as Strongly Agree. Based
on the answers, a usability score can be computed and the result interpreted based on the
Bangor et al. scale [2]. However, the SUS is used to quantify the usability and not to explain
why problems in usability occur and therefore was used together with observations to get
a richer overview of the usability of the game.
5.4.1 Participants
A total of 29 participants from different socioeconomic backgrounds and ages participated
in the study on a voluntary basis. The participants were selected from two UK primary
schools and an afterschool club. Their ages were between 8 and 11 years old, with an average
age of 9.5 years old. A total of 15 participants were females and 14 were males.
5.4.2 Set-Up
The children were provided with a mobile phone (Samsung Galaxy S4). The game was pre-
installed on the mobile phone. They were asked to play the game for 30 minutes. Afterwards
they were asked to fill a questionnaire which include questions asking about: their age and
gender and the SUS questionnaire. After the study the children participated in a brief focus
group with the researcher present. The focus group focused on the issues observed during
the game play session.
5.5 SUMMARY
This chapter presented edugames4all MicrobeQuest! [33], a game aimed at teaching children
about hygiene and responsible antibiotic use. The challenges developing the mobile version
of this game are discussed. The chapter also presents the learning objectives covered in the
game and how they have been integrated into the game mechanics. A usability study was
performed following a mixed method approach [6]. The results of the study showed that
the game usability is good, children finding the game overall easy to learn and use, but the
game mechanics employed has been found difficult to execute on the mobile phone.
We learned several lessons from this study. First, some of the game mechanics could not be
translated directly to the mobile phones from the desktop version. Second, the children’s speed
of playing the game might be different between the mobile and desktop version of the game.
Third, catering for different platforms and screen sizes required adaptation of the game. Fourth,
the assets developed for the desktop version of the game needed considerable adaptation for the
mobile version. Fifth, the internet connection, which is often guaranteed when the games are
played from the desktop browser, could pose challenges on the mobile devices.
In our future work, we want to explore the game’s potential to teach children and change
behaviour. With the growing usage of mobile phones among children, we are also exploring
performing an in-depth study which considers children’s differences in interaction between
the desktop and mobile version of the game with focus on improving the engagement with
the mobile version, and how these affect usability, enjoyment, and learning.
REFERENCES
1. Bangor, A., Kortum, P., and Miller, J. A. 2008. The system usability scale (SUS): An empirical
evaluation. International Journal of Human-Computer Interaction, 24(6), 574–594.
136 ◾ Mobile Apps Engineering
2. Bangor, A., Kortum, P., and Miller, J. 2009. Determining what individual SUS scores mean:
Adding an adjective rating scale. Journal of Usability Studies, 4(3), 114–123.
3. Bellotti, F., Kapralos, B., Lee, K., Moreno-Ger, P., and Berta, R. 2013. Assessment in and of
serious games: An overview. Advances in Human-Computer Interaction, 2013, article no. 1.
4. Brooke, J. 1996. SUS-A quick and dirty usability scale. Usability Evaluation in Industry,
189(194), 4–7.
5. Business Wire. 2017. Android Overtakes Windows for First Time – StatCounter. Available
online: http://www.businesswire.com/news/home/20170403005635/en/Android-Overtakes-
Windows-Time-%E2%80%93-StatCounter (Accessed October 27, 2017).
6. Creswell, J. W., and Clark, V. L. P. 2007. Designing and Conducting Mixed Methods Research.
Sage, Thousand Oaks, CA, USA.
7. Eng, J. V., Marcus, R., Hadler, J. L., Imhoff, B., Vugia, D. J., Cieslak, P. R., and Hawkins, M. A.
2003. Consumer attitudes and use of antibiotics. Emerging Infectious Diseases, 9(9), 1128.
8. Farrell, D., Kostkova, P., Lazareck, L., Weerasinghe, D., Weinberg, J., Lecky, D. M., and Merakou,
K. 2011a. Developing e-Bug web games to teach microbiology. Journal of Antimicrobial
Chemotherapy, 66(suppl_5), v33–v38.
9. Farrell, D., Kostkova, P., Weinberg, J., Lazareck, L., Weerasinghe, D., Lecky, D. M., and
McNulty, C. A. 2011b. Computer games to teach hygiene: An evaluation of the e-Bug junior
game. Journal of Antimicrobial Chemotherapy, 66(suppl_5), v39–v44.
10. Hodhod, R., Cairns, P., and Kudenko, D. 2011. Innovative Integrated Architecture for
Educational Games: Challenges and Merits. Springer, Berlin, Heidelberg, pp. 1–34. In Pan
Z., Cheok A.D., Müller W., Yang X. (eds) Transactions on Edutainment V. Lecture Notes in
Computer Science, vol. 6530.
11. House of Lords. 1998. Resistance to antibiotics and other antimicrobial agents. Select
Committee Report on Science and Technology, HL paper no. 81–I. London, UK.
12. Hupont, I., Gracia, J., Sanagustin, L., and Gracia, M. A. 2015. May. How do new visual
immersive systems influence gaming QoE? A use case of serious gaming with Oculus Rift. In
2015 Seventh International Workshop on Quality of Multimedia Experience (QoMEX), pp. 1–6.
IEEE., Piscataway, NJ, USA.
13. Kapp, K. M. 2012. The Gamification of Learning and Instruction: Game-Based Methods and
Strategies for Training and Education. John Wiley & Sons.
14. Kirriemuir, J., and McFarlane, A. 2004. Literature review in games and learning. Available at:
https://telearn.archives-ouvertes.fr/hal-00190453/document. Accessed at 19 September 2018.
Accessed at 19 September 2018.
15. Klabbers, J. H. 2003. The gaming landscape: A taxonomy for classifying games and simulations.
In DiGRA Conference, November 4–6, 2003, Utrecht, The Netherlands.
16. Kostkova, P. 2011, November. Seamless evaluation of interactive digital storytelling games:
Edugames4All. In International Conference on Electronic Healthcare, (pp. 80–84). Springer,
Berlin Heidelberg.
17. Kostkova, P. 2015a. Grand challenges in digital health. Frontiers in Public Health, 3(134), doi:
10.3389/fpubh.2015.00134.
18. Kostkova, P. 2015b. User engagement with digital health technologies. In O’Brien, H. and
Cairns, P. (Eds): Why Engagement Matters: Cross-Disciplinary Perspectives of User Engagement
in Digital Media, Springer international, Chams, Switzerland.
19. Kostkova, P. and Molnar, A. 2014. Educational games for creating awareness about health
issues: The case of educational content evaluation integrated in the game. In Medicine 2.0
Conference. JMIR Publications Inc., Toronto, Canada.
20. Lazareck, L. J., Farrell, D., Kostkova, P., Lecky, D. M., McNulty, C. A., and Weerasinghe, D. 2010.
Learning by gaming-evaluation of an online game for children. In 2010 Annual International
Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), pp. 2951–2954.
IEEE., Piscataway, NJ, USA.
Teaching Hygiene and Responsible Antibiotic Use through a Mobile Game for Children ◾ 137
21. Lecky, D. M., McNulty, C. A., Adriaenssens, N., Koprivová Herotová, T., Holt, J., Touboul, P., and
Campos, J. 2011. What are school children in Europe being taught about hygiene and antibiotic
use?. Journal of Antimicrobial Chemotherapy, 66(suppl_5), v13–v21.
22. Madle, G., Kostkova, P., Mani-Saada, J., and Weinberg, J. R. 2003. Evaluating the changes in
knowledge and attitudes of digital library users. In International Conference on Theory and
Practice of Digital Libraries, ECDL 2003, pp. 29–40. Springer, Berlin, Heidelberg.
23. Markouzis, D., and Fessakis, G. 2016. Rapid prototyping of interactive storytelling and mobile
augmented reality applications for learning and entertainment—The case of “k-Knights”.
International Journal of Engineering Pedagogy, 6(2), 30–38.
24. McNulty, C. A., Cookson, B. D., and Lewis, M. A. 2012. Education of healthcare professionals
and the public. Journal of Antimicrobial Chemotherapy, 67(suppl_1), i11–i18.
25. Merriam, S. B., and Tisdell, E. J. 2015. Qualitative Research: A Guide to Design and
Implementation. 4th edition. Wiley/Jossey-Bass, New York.
26. Molnar, A. 2014. On better understanding the usage of mobile phones for learning purposes.
Bulletin of the IEEE Technical Committee on Learning Technology, 16(2/3), 18–20.
27. Molnar, A., Farrell, D., and Kostova, P. 2012. Who poisoned hugh?-the STAR framework:
Integrating learning objectives with storytelling. In International Conference on Interactive
Digital Storytelling, pp. 60–71. Springer, Berlin, Heidelberg.
28. Molnar, A., and Kostkova, P. 2013a. Seamless evaluation integration into IDS educational
games. In International Conference on the Foundations of Digital Games (FDG 2013), pp. 322–
329. Chania, Crete, Greece, May 14–17, 2013. Society for the Advancement of the Science of
Digital Games, Santa Cruz, CA, USA. ISBN: 978-0-9913982-0-1
29. Molnar, A., and Kostkova, P. 2013b. On effective integration of educational content in serious
games: Text vs. game mechanics. In 2013 IEEE 13th International Conference on Advanced
Learning Technologies (ICALT), pp. 299–303. IEEE., Piscataway, NJ, USA.
30. Molnar, A., and Kostkova, P. 2013c. If you build it would they play? Challenges and solutions
in adopting health games for children. Proceedings of ACM SIGCHI Conference on Human
Factors in Computing Systems, Let’s talk about Failures: Why was the Game for Children not a
Success. ACM, New York, NY, USA.
31. Molnar, A., and Kostkova, P. 2015. Mind the gap: From desktop to app. In Proceedings of
the 5th International Conference on Digital Health 2015, pp. 15–16. ACM, New York, NY,
USA.
32. Molnar, A., and Kostkova, P. 2016a. Ubiquitous bugs and drugs education for children through
mobile games. In Proceedings of the 6th International Conference on Digital Health Conference,
pp. 77–78. ACM, New York, NY, USA.
33. Molnar, A., and Kostkova, P. 2016b. Interactive Digital Storytelling based educational
games: Formalise, author, play, educate and enjoy!-The edugames4all project framework. In
Transactions on Edutainment XII, pp. 1–20. Springer, Berlin Heidelberg.
34. Molnar, A., and Kostkova, P. 2018. Learning about hygiene and antibiotic resistance through
mobile games: Evaluation of learning effectiveness. In DH’18: 2018 International Digital Health
Conference, pp 95–99. Lyon, France, April 23–26. ACM, New York, NY, USA.
35. Muri, R., and Mosimann, U. P. 2016. Usability assessment of natural user interfaces during
serious games: Adjustments for dementia intervention. Journal of Pain Management, 9(3), 333.
36. Padilla-Zea, N., Gutiérrez, F. L., López-Arcos, J. R., Abad-Arranz, A., and Paderewski, P. 2014.
Modeling storytelling to be used in educational video games. Computers in Human Behavior,
31, 461–474.
37. Robertson, J. C., and Howells, C. 2008. Computer game design: Opportunities for successful
learning. Computers & Education, 50(2), 559–578.
38. Serrano, Á., Marchiori, E. J., del Blanco, Á., Torrente, J., and Fernández-Manjón, B. 2012, April.
A framework to improve evaluation in educational games. In 2012 IEEE Global Engineering
Education Conference (EDUCON), pp. 1–8, IEEE., Piscataway, NJ, USA.
138 ◾ Mobile Apps Engineering
39. SMAC - Standing Medical Advisory Committee, Sub-group on antimicrobial resistance. 1998.
The Path of Least Resistance. Department of Health, London, UK. Available at http://webarchive.
nationalarchives.gov.uk/20081106020107/http://www.dh.gov.uk/en/Publicationsandstatistics/
Publications/PublicationsPolicyAndGuidance/DH_4009357.
40. Svarovsky, G. N., Shaffer, D. W. 2006. SodaConstructing an understanding of physics:
Technology-based engineering activities for middle school students. 36th ASEE/IEEE Frontiers
in Education Conference, San Diego, CA. Available at http://epistemicgames.org/cv/papers/
FIE_sodaconstructor_final.pdf.
41. Tlili, A., Essalmi, F., and Jemni, M. 2016. Improving learning computer architecture through
an educational mobile game. Smart Learning Environments, 3(1), 7.
42. Vallejo, V., Mitache, A. V., Tarnanas, I., Müri, R., Mosimann, U. P., and Nef, T. 2015.
Combining qualitative and quantitative methods to analyze serious games outcomes: A pilot
study for a new cognitive screening tool. In 2015 37th Annual International Conference of the
IEEE Engineering in Medicine and Biology Society (EMBC), pp. 1327–1330. IEEE., Piscataway,
NJ, USA.
Index
139
140 ◾ Index
GlobalPlatform, 28 J
Google Map, 69
Java virtual machine, 94
GPS, 5, 19, 21, 53, 110
JavaEE, 121
GPU, 5
JavaScript, 7, 111, 132, 133
Granted permissions, 14, 24
JavaScript object notation, 111
Graphical user interface, 37, 38, 50, 51, 54, 71
JDBC, 105, 121
Model, 53
JSON, 111, 112, 117, 119, 121
GSON, 112, 121
JUnit, 90, 92, 94
H
K
Hand veins, 26
Hardware capabilities, 15, 20 Kangaroo transaction model, 42
Hardware isolation, 10 Kernel, 8, 9, 23, 27
HashMap, 114, 118 Key logging, 8
HDD, 22 Keypool transaction model, 43, 45
HIDS, 30
High-risk permission, 10 L
Horizontal prototyping, 38
Host resource usage, 31 Layering, 105, 120
HTML, 93 Learning objective, 128–131, 135
HTML5, 50, 132, 133 Legitimate application, 6
Hybrid analysis, 30 Limited time access, 15, 17
Hypervisor, 27 Linux, 8, 9, 19, 24, 25, 92
Lipizzan spyware, 7
Local transaction management, 36, 46, 47,
I 49, 68, 72
IBM simon, 4, 5 Location monitoring, 7
ICC, 9 Location services, 4, 21
IDS, 12, 29, 30 Location tracking, 17, 18
Image-based integration, 45 Log analysis, 15, 18
Information systems, 38 Low-risk permission, 10
Integrated development environment, LTS, 8, 16
111, 121
Integration testing, 80
M
Intents, 9, 29, 80
Interactive digital storytelling, 129 Malicious activities, 15, 29, 30, 85
Intercomponent communications, 9 Malicious code, 6, 7
Interested functions, 103 Malicious software, 6, 7
Internal storage, 24, 26 Malignant transaction, 7
Internal storage file system, 26 Malware, 2, 3, 4, 7, 8, 14, 18, 23,
Internet access, 6 30, 31, 85
Internet of Things, 93 Mandatory access control, 9
Interprocess communications, 9, 25 Manifest file, 9
Intrusion detection, 12, 29, 30 Manipulation, 4
iOS, 8, 24, 26, 27, 36, 79, 93 MDAM, 3, 12, 13, 19, 20
iOS ecosystem, 7 MDM, 11, 19, 20
IPC framework, 9 Medical images, 78
iPhone, 4, 5, 14, 15 Medication information, 78
iPhone 6, 4, 5 Memory constraints, 132, 133
iPhone X, 4, 5 Microphone, 5, 15, 52
Iris scan, 26 MMS, 6
Isolation-only transaction model, 42 Mob4Hire, 91
142 ◾ Index
W XMLHttpRequest, 7
Warranty process, 11
Z
Weakly state commutative, 61
Web applications, 78, 92 Zalando, 40
Web browsing, 6, 20 Zero day, 18