You are on page 1of 64

PROGRAMMING OF MOBILE TERMINALS AND

APPLICATION SECURITY
HANDOUT
Detailed Lesson notes with practical exercises and applications in Programming of Mobile
Terminals and Application Security

Lecturer: ATSOPMENE VANETTE


PhD Student in Software Engineering
MSc in Industrial Computing & Electronics
PLET Computer Science

February 2021
Objectives
This course offers an introduction to mobile terminal programming and application security.
Toward this goal students will learn how to:
- Specify the generalities of mobile terminals
- Understand the functioning of the Android Operating System
- Be able to differentiate the various mobile terminals
- Understand Embedded Systems and How they operate
- Identify different Web applications for mobile platforms
- Security requirements for a mobile terminal
- Vulnerability assessment of a mobile system
- Security patches and updates.

Table of Contents
PART 1 – PROGRAMMINGG OF MOBILE TERMINALS........................................................... 4
SECTION 1 – GENERALITIES OF MOBILE TERMINALS..................................................... 4
1.1 Introduction ............................................................................................................................. 4
1.2 Types of Mobile Computing Devices ............................................................................... 4
Mobile Operating Systems (Mobile OS) ...................................................................................... 6
Early Mobile OS ............................................................................................................................ 7
1.3 Mobile Computing - Major Advantages................................................................................ 8
SECTION 2 – ANDROID OPERATING SYSTEM .................................................................... 10
2.1 History of the Android Operating System .......................................................................... 10
2.2 Features of the Android Operating System ........................................................................ 11
2.3 Android Architecture:........................................................................................................... 11
2.4 Security and Privacy ............................................................................................................. 14
2.5 Mobile Security Threats........................................................................................................ 14
SECTION 3 – EMBEDDED SYSTEMS ....................................................................................... 16
3.1 Overview of Embedded Systems .......................................................................................... 16
3.2 Characteristics of an Embedded System ............................................................................. 17
3.3 Advantages of Embedded Systems....................................................................................... 18
3.4 Disadvantages of Embedded Systems .................................................................................. 18
3.5 Basic Structure of an Embedded System ............................................................................ 18
3.6 Types of Embedded System .................................................................................................. 19
3.7 Microcontroller Performance Based Embedded System ................................................... 21

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 1
3.8 Some real-life applications of Embedded Systems ............................................................. 22
3.9 Advantages of Embedded System ............................................................................................ 22
3.10 Disadvantages of Embedded System ..................................................................................... 22
3.11 Components of the Embedded System .............................................................................. 23
3.12 Hardware Components of the Embedded System ............................................................ 25
Conclusion ..................................................................................................................................... 25
SECTION 4 – iOS ENVIROMENT............................................................................................... 26
4.1 History and Overview of the iOS System ............................................................................ 26
4.2 Features of the iOS System ............................................................................................. 26
4.4 Hardware Platform of the iOS System .......................................................................... 26
4.5 Development Platform of the iOS System ..................................................................... 26
4.6 Security and Privacy ....................................................................................................... 27
SECTION 5 – WEB APPLICATIONS FOR MOBILE PLATFORMS ..................................... 28
5.1 Differences between Web, Native and Cross-Platform Apps ...................................... 28
5.1.3 Cross-platform applications .............................................................................................. 30
Conclusions ................................................................................................................................... 31
5.2 Tools for building web applications ............................................................................... 31
SECTION 6 – MOBILE AND WEB APPLICATION DEVELOPMENT PLATFORMS ...... 32
6.1 Some Mobile App Development Frameworks .............................................................. 32
SECTION 7 – INTRODUCTION TO ANDROID PROGRAMMING ...................................... 37
7.1 Prerequisites of Android Programming .............................................................................. 37
7.2 Android Studio Environment Installation And Configuration ......................................... 39
7.3 SDK MANAGER ................................................................................................................... 41
7.4 Creating Android Virtual Device with AVD Manager .............................................................. 44
7.5 Android - Application Components ............................................................................................. 46
SECTION 8 – MY FIRST ANDROID APPLICATION.............................................................. 52
8.1 App Basics .............................................................................................................................. 52
8.2 Hello World! Android Application ...................................................................................... 52
8.3 Anatomy of Android Application......................................................................................... 55
8.4 The Main Activity File .......................................................................................................... 57
8.5 The Manifest File ................................................................................................................... 57
8.6 The Strings File ...................................................................................................................... 59
8.7 The Layout File ...................................................................................................................... 59
8.8 Running the Application ....................................................................................................... 60

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 2
SECTION 9 – ANDROID CODENAMES, TAGS AND BUILD NUMBERS ........................... 61
SECTION 10 – ANDROID LAYOUTS AND HOW TO USE THEM ....................................... 61
SECTION 11 – ANDROID CONTROLS AND EVENT HANDLERS ...................................... 61
SECTION 12 – ANDROID AND DATABASE............................................................................. 62
SECTION 13 – GROUPS ON ANDROID DEVELOPMENT .................................................... 62
SECTION 14 – ANDROID PROJECTS ....................................................................................... 63

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 3
PART 1 – PROGRAMMINGG OF MOBILE TERMINALS

SECTION 1 – GENERALITIES OF MOBILE TERMINALS

1.1 Introduction
A mobile communication device is a small, portable electronic device, with wireless
communication capabilities, which is easy to carry around. Some mobile terminals can send
and receive signals over a radio link while being connected to a base station. Mobile PCs, cell
phones and PDAs, as well as multifunctional appliances, e.g. smart phones (cell phone and
PDA) considered as mobile terminals.
Mobile data terminals feature a screen on which to view information and a keyboard or keypad
for entering information, and may be connected to various peripheral devices.
Today’s mobile devices are multifunctional devices capable of hosting a broad range of
applications for both business and consumer use. Smartphones and tablets enable people to use
their mobile device to access the Internet for email, instant messaging, text messaging and Web
browsing, as well as work documents, contact lists and more.
Mobile devices are often seen as an extension to your own PC or laptop, and in some cases
newer, more powerful mobile devices can even completely replace PCs. And when the devices
are used together, work done remotely on a mobile device can be synchronized with PCs to
reflect changes and new information while away from the computer.

1.2 Types of Mobile Computing Devices


The term mobile device refers to a wide range of consumer electronics. Mobile device typically
is used to describe portable devices that can connect to the Internet. However, some also classify
connected digital cameras and standard MP3 players as mobile devices as well. The category
of mobile devices includes the following devices, as well as others:

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 4
A) Personal Digital Assistant (PDA)
The name of PDA is Pocket computer; this device is capable to
transmit data from one terminal to other terminal with
synchronization. In the PDA have all functionality such as making
call voice/video, calendar, and more. Today, PDAs are available in
different types of operating system like as Apple iOS, Windows
Mobile, Blackberry, and Google’s Android.
PDAs have largely been rendered obsolete by the rise in popularity
of smartphones and tablets, but they still retain a presence in niche
markets (A niche market is the subset of the market on which a specific product is focused).
Examples of PDA devices through the years have included the Palm Pilot, Revo, Sony Clie,
Hewlett-Packard Jornado, Casio Cassiopedia, Compaq iPaq and Toshiba Pocket PC.

b) Smartphones
Smartphones combine a mobile phone and a handheld computer into a single device.
Smartphones allow users to access and store information (e.g. e-mail) and install programs

(applications) while also being able to use a mobile phone in one device. For example, a
smartphone could be a mobile phone with some PDA functions integrated into the device or
vice versa. Examples of smartphones over the years have included the Apple iPhone, Samsung
Galaxy, Microsoft and Nokia Lumia, Sony Ericsson, Palm Treo, Blackberry, Nokia T-Mobile
Sidekick, Torq, Motorola Q, E-Ten, HP iPaq and I-mate.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 5
c) Tablet PCs
Tablet PCs are an evolution of the notebook computer with
touchscreen LCD screens that can be utilized with your
fingertips or with a stylus. The handwriting with a stylus
is digitized and can be converted to standard text through
handwriting recognition, or it can remain as handwritten
text. The stylus can also be used to type on a pen-based
key layout where the lettered keys are arranged differently
than a QWERTY keyboard. Tablet PCs may also offer a
removable keyboard as an additional input option.
Examples of tablet PCs have included Apple iPad, Microsoft Surface and Surface Pro, Samsung
Galaxy Tab, Samsung Nexus, Amazon Kindle Fire HD and Lenovo Yoga.

Mobile Operating Systems (Mobile OS)


Like a computer operating system, a mobile operating system is the software platform for
mobile devices on top of which other programs run. When you purchase a mobile device, the
manufacturer will have chosen the mobile OS for that specific device. The mobile operating
system is responsible for determining the functions and features available on your device, such
as thumbwheel, keyboards, WAP, synchronization with applications, e-mail, text messaging
and more.
The mobile operating system will also determine which third-party applications can be used on
your device. Some of the more common and well-known mobile operating systems include the
following:

i) Apple iOS
Apple’s iOS mobile operating system powers the company’s line of mobile devices like the
iPhone, iPad, iPod touch, and Apple TV. Apple iOS was originally called the iPhone OS but
was renamed in 2010 to reflect the operating system’s evolving support for additional Apple
devices. Apple updated iOS to iOS 9 in 2015 in conjunction with the company’s OS X El
Capitan operating system release.
ii) Google Android
Google Android is a mobile operating system based on Linux that has quickly become the
biggest competitor to Apple iOS in the mobile device market. Google originally released

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 6
Android’s source code under open-source licenses, and today the company continues to develop
the mobile OS privately prior to major update releases that are made available to OEMs and the
public. Manufacturers of Android-powered smartphone and tablet devices include Samsung,
Sony, Asus, Amazon, HTC and LG, as well as Google itself.

iii) Windows Phone


Originally called the Windows Mobile platform and then Windows Phone, Microsoft’s mobile
OS is available on a variety of devices from a variety of wireless operators. You will find
Windows Phone on Microsoft hardware devices as well as Nokia, Dell, HP, Motorola, Palm
and i-mate products. Microsoft unveiled the latest release of its mobile operating system,
Windows 10 Mobile, in late 2015 as part of the Windows 10 family of operating systems.

Early Mobile OS
While not as frequently encountered in today’s market, some of the earlier generation mobile
OSes have included:

iv) Palm OS
Since the introduction of the first Palm Pilot in 1996, the Palm OS platform has provided mobile
devices with essential business tools, as well as capability to access the Internet or a central
corporate database via a wireless connection. Link: Palm OS Web site

v) Symbian OS
Symbian OS has become a standard operating system for smartphones, and is licensed by more
than 85 percent of the world’s handset manufacturers. The Symbian OS is designed for the
specific requirements of 2.5G and 3G mobile phones.

vi) Linux
The first company to launch phones with Linux as its OS was Motorola in 2003. Linux has been
seen as a suitable option for higher-end phones with powerful processors and larger amounts of
memory.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 7
vii) MXI
MXI is a universal mobile operating system that allows existing full-fledged desktop and
mobile applications written for Windows, Linux, Java and Palm to be enabled immediately on
mobile devices without any redevelopment. MXI allows for interoperability between various
platforms, networks, software and hardware components.

1.3 Mobile Computing - Major Advantages


Mobile computing has changed the complete landscape of our day-to-day life. Following are
the major advantages of Mobile Computing –

Location Flexibility: This has enabled users to work from anywhere as long as there is a
connection established. A user can work without being in a fixed position. Their mobility
ensures that they are able to carry out numerous tasks at the same time and perform their stated
jobs.

Saves Time: The time consumed or wasted while travelling from different locations or to the
office and back, has been slashed. One can now access all the important documents and files
over a secure channel or portal and work as if they were on their computer. It has enhanced
telecommuting in many companies. It has also reduced unnecessary incurred expenses.
Enhanced Productivity: Users can work efficiently and effectively from whichever location
they find comfortable. This in turn enhances their productivity level.
Ease of Research: Research has been made easier, since users earlier were required to go to the
field and search for facts and feed them back into the system. It has also made it easier for field
officers and researchers to collect and feed data from wherever they are without making
unnecessary trips to and from the office to the field.

Entertainment: Video and audio recordings can now be streamed on-the-go using mobile
computing. It's easy to access a wide variety of movies, educational and informative material.
With the improvement and availability of high speed data connections at considerable cost, one
is able to get all the entertainment they want as they browse the internet for streamed data. One
is able to watch news, movies, and documentaries among other entertainment offers over the
internet. This was not possible before mobile computing dawned on the computing world.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 8
Streamlining of Business Processes : Business processes are now easily available through
secured connections. Looking into security issues, adequate measures have been put in place to
ensure authentication and authorization of the user accessing the services. Some business
functions can be run over secure links and sharing of information between business partners
can also take place. Meetings, seminars and other informative services can be conducted using
video and voice conferencing. Travel time and expenditure is also considerably reduced.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 9
SECTION 2 – ANDROID OPERATING SYSTEM
Android is a mobile operating system based on a modified version of the Linux kernel and other
open-source software, designed primarily for touchscreen mobile devices such as smartphones
and tablets.
2.1 History of the Android Operating System
Android Inc was founded in Palo Alto, California in 2003 by Rich Miner, Nick Sears, Chris
White, and Andy Rubin. It was developed with objective to make “smarter mobile devices that
are more aware of its owner’s location and preferences.” Google bought Android in 2005 and
everything changed. The hardware that supports android software is based on the ARM
architecture platform. ARM is a family of RISC architectures for computer processors,
configured for various environments. The android is an open-source operating system that
means that it’s free and anyone can use it. The android has got millions of apps available that
can help you manage your life one or another way and it is available to low cost in the market
for that reason android is very popular.
NAME VERSION NUMBER(S) RELEASE DATE
No official codename 1.0 September 23, 2008
1.1 February 9, 2009
Cupcake 1.5 April 27, 2009
Donut 1.6 September 15, 2009
Eclair 2.0 – 2.1 October 26, 2009
Froyo 2.2 – 2.2.3 May 20, 2010
Gingerbread 2.3 – 2.3.7 December 6, 2010
Honeycomb 3.0 – 3.2.6 February 22, 2011
Ice Cream Sandwich 4.0 – 4.0.4 October 18, 2011
Jelly Bean 4.1 – 4.3.1 July 9, 2012
KitKat 4.4 – 4.4.4 October 31, 2013
Lollipop 5.0 – 5.1.1 November 12, 2014
Marshmallow 6.0 – 6.0.1 October 5, 2015
Nougat 7.0 – 7.1.2 August 22, 2016
Oreo 8.0 – 8.1 August 21, 2017
Pie 9 August 6, 2018
Android 10 10 September 3, 2019

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 10
Android 11 11 September 8, 2020

2.2 Features of the Android Operating System


All the android applications are at the top layer and are installed on this layer. Examples of such
applications are contacts, books, browsers, services, etc. Each application performs a different
role in the overall applications.
Features:
 Headset layout
 Storage
 Connectivity: GSM/EDGE, IDEN, CDMA, Bluetooth, WI-FI, EDGE,3G, NFC,
LTE,GPS.
 Messaging: SMS, MMS, C2DM (could to device messaging), GCM (Google could
messaging)
 Multilanguage support
 Multi-touch
 Video calling
 Screen capture
 External storage
 Streaming media support
 Optimized graphics

2.3 Android Architecture:


The android is an operating system and is a stack of software components which is divided into
five sections and four main layers that is
 Linux kernel
 Libraries
 Android runtime
Application framework:

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 11
2.3.1 Linux kernel:
The android uses the powerful Linux kernel and it supports a wide range of hardware drivers.
The kernel is the heart of the operating system that manages input and output requests from the
software. This provides basic system functionalities like process management, memory
management, device management like camera, keypad, display etc the kernel handles all the
things. Linux is really good at networking and it is not necessary to interface it to the peripheral
hardware. The kernel itself does not interact directly with the user but rather interacts with the
shell and other programs as well as with the hardware devices on the system.

2.3.2 Libraries:
It is on top of a Linux kennel there is a set of libraries including open-source web browsers such
as WebKit, library libc. These libraries are used to play and record audio and video. The SQLite
is a database that is useful for the storage and sharing of application data. The SSL libraries are
responsible for internet security etc.

2.3.3 Android Runtime:


The android runtime provides a key component called Dalvik Virtual Machine which is a kind
of java virtual machine. It is specially designed and optimized for android. The Dalvik VM is

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 12
the process virtual machine in the android operating system. It is a software that runs apps on
android devices.
The Dalvik VM makes use of Linux core features like memory management and multithreading
which is in java language. The Dalvik VM enables every Android application to run its own
process. The Dalvik VM executes the files in the .dex format.

2.3.4 Application framework:


The application framework layer provides many higher-level services to applications such as
windows manager, view system, package manager, resource manager, etc. The application
developers are allowed to make use of these services in their application.

2.3.5 Android Emulator:


The Emulator is a new application in the Android operating system. The emulator is a new
prototype that is used to develop and test android applications without using any physical
device.

The android emulator has all of the hardware and software features like mobile devices except
phone calls. It provides a variety of navigation and control keys. It also provides a screen to
display your application. The emulators utilize the android virtual device configurations. Once

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 13
your application is running on it, it can use services of the android platform to help other
applications, access the network, play audio, video, store, and retrieve the data.

Advantages of the Android OS:


 Android is a Linux based open-source operating system, it can be developed by anyone
 Easy access to android apps
 You can replace the battery and mass storage, disk drive and UDB option
 Its supports all Google services
 The operating system is able to inform you of a new SMS and Emails or latest updates.
 It supports Multitasking
 Android phone can also function as a router to share internet
 It’s free to customize
 Can install a modified ROM
 Its supports 2D and 3D graphics

2.4 Security and Privacy


Android as an operating system is very secure. It has multiple layers of protection to keep
malware at bay, and it requires your specific permission to do almost anything that could lead
to your data or the system being compromised. Mobile security apps are applications designed
for smartphone and tablet mobile devices to protect and secure the device and its data from
unauthorized access in the case of theft or accidental loss. Some mobile security apps can also
help users locate their device if it s lost or stolen.
Additional security features frequently offered by Android mobile security apps include
securing data on the device, VPN connectivity for protecting data in transit, scanning websites
for potential phishing schemes or other fraudulent activity, helping users locate their device if
lost or stolen, and more.

2.5 Mobile Security Threats


Mobile security threats include both physical and software-based threats that can compromise
the data on smartphones, tablets and similar mobile devices. Mobile security threats include
everything from mobile forms of malware and spyware to the potential for unauthorized access
to a device s data, particularly in the case of accidental loss or theft of the device.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 14
Mobile malware and spyware security threats can access a device s private data without a user
s knowledge or consent and can also perform malicious actions without the user knowing,
including transferring control of the device to a hacker, sending unsolicited messages to the
device s contacts, making expensive phone calls on smartphones, and more.

2.5.1 Physical Mobile Security Threats and Other Types of Threats


When it comes to physical mobile security threats, phones that lack passwords, screen locks or
other forms of authentication are vulnerable to unauthorized access, which can compromise
sensitive information stored on the mobile device. And if the device gets lost or stolen, hackers
can bypass many forms of authentication in order to gain access to the device s sensitive
information.
Additional types of mobile security threats include applications that take advantage of
vulnerabilities in the mobile operating system or a mobile application to gain access and/or
control of the device, phishing scams, Web browser and network-based exploits, Wi-Fi packet
sniffing for accessing mobile device data

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 15
SECTION 3 – EMBEDDED SYSTEMS
3.1 Overview of Embedded Systems
An embedded system can be defined as a microcontroller-based, software-driven, reliable, real-
time control system, designed to perform a specific task. It can be thought of as a computer
hardware system having software embedded in it. An embedded system can be either an
independent system or a part of a large system. In this course, we will explain all the steps
necessary to design an embedded system and use it.
Embedded means something that is attached to another thing. An embedded system can be
thought of as a computer hardware system having software embedded in it. An embedded
system can be an independent system or it can be a part of a large system. An embedded system
is a microcontroller or microprocessor based system which is designed to perform a specific
task. For example, a fire alarm is an embedded system; it will sense only smoke.
An embedded system has three components −
 It has hardware.
 It has application software.
 It has Real Time Operating system (RTOS) that supervises the application software and
provide mechanism to let the processor run a process as per scheduling by following a
plan to control the latencies. RTOS defines the way the system works. It sets the rules
during the execution of application program. A small scale embedded system may not
have RTOS.
Examples of embedded systems include:
 central heating systems.
 engine management systems in vehicles.
 domestic appliances, such as dishwashers, TVs and digital phones.
 digital watches.
 electronic calculators.
 GPS systems.
 fitness trackers.
So we can define an embedded system as a Microcontroller based, software driven, reliable,
real-time control system.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 16
3.2 Characteristics of an Embedded System
 Single-functioned − An embedded system usually performs a specialized operation and
does the same repeatedly. For example: A pager always functions as a pager.
 Tightly constrained − All computing systems have constraints on design metrics, but
those on an embedded system can be especially tight. Design metrics is a measure of an
implementation's features such as its cost, size, power, and performance. It must be of
a size to fit on a single chip, must perform fast enough to process data in real time and
consume minimum power to extend battery life.
 Reactive and Real time − Many embedded systems must continually react to changes
in the system's environment and must compute certain results in real time without any
delay. Consider an example of a car cruise controller; it continually monitors and reacts
to speed and brake sensors. It must compute acceleration or de-accelerations repeatedly
within a limited time; a delayed computation can result in failure to control of the car.
 Microprocessors based − It must be microprocessor or microcontroller based.
 Memory − It must have a memory, as its software usually embeds in ROM. It does not
need any secondary memories in the computer.
 Connected − It must have connected peripherals to connect input and output devices.
 HW-SW systems − Software is used for more features and flexibility. Hardware is used
for performance and security.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 17
3.3 Advantages of Embedded Systems
 Easily Customizable
 Low power consumption
 Low cost
 Enhanced performance
3.4 Disadvantages of Embedded Systems
 High development effort
 Larger time to market

3.5 Basic Structure of an Embedded System


The following illustration shows the basic structure of an embedded system −

 Sensor − It measures the physical quantity and converts it to an electrical signal which
can be read by an observer or by any electronic instrument like an A2D converter. A
sensor stores the measured quantity to the memory.
 A-D Converter − An analog-to-digital converter converts the analog signal sent by the
sensor into a digital signal.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 18
 Processor & ASICs − Processors process the data to measure the output and store it to
the memory.
 D-A Converter − A digital-to-analog converter converts the digital data fed by the
processor to analog data
 Actuator − An actuator compares the output given by the D-A Converter to the actual
(expected) output stored in it and stores the approved output.

3.6 Types of Embedded System


Embedded systems can be classified based on:
 Performance and Functional requirements
 Performance of the Microcontroller

Fig. 3 – Types of Embedded System

3.6.1 Performance and Functional Requirement Based Embedded Systems


Embedded Systems can be classified into four types based on the performance and functional
requirement.
 Real Time Embedded Systems
 Stand-Alone Embedded Systems
 Networked Embedded Systems

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 19
 Mobile Embedded Systems

3.6.2 Real Time Embedded Systems


A Real Time Embedded System provides output within a defined specific time. That is, real
time embedded systems are designed and created to perform some specific work in pre-
specified time. Examples include: Traffic control system, Military usage in defense sector,
Medical usage in health sector

3.6.2.1 Types of Real Time Embedded Systems


There are two types of Real Time Embedded System. They are:
 Soft Real Time Embedded Systems
 Hard Real Time Embedded Systems

3.6.3 Stand Alone Embedded Systems


Stand-Alone Embedded Systems are those that can work by themselves i.e. they are self-
sufficient and do not depend on a host system. Stand-alone embedded systems are made in a
way such that an input is received, processed and thereafter the desired output is produces.
Examples include: MP3 players, Microwave ovens, calculator. Input can be received via
sensors, keyword or push button.

3.6.4 Networked Embedded Systems


Networked Embedded Systems depend on connected network to perform its assigned tasks.
These systems consist of components like sensors, controllers etc. which are interconnected.
Many of these systems are built on general purpose processors. Examples: Home security
systems, ATM machine, Card swipe machine

3.6.5 Mobile Embedded Systems


Mobile Embedded Systems are those that are small sized and can be used in smaller devices.
They are used in mobile phones and digital cameras because of the small size. They often have
memory constraints and lacks good user interface. Ex: MP3 player, Mobile phones, Digital
Camera

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 20
3.7 Microcontroller Performance Based Embedded System
Embedded System are classified in three types based on its microcontroller performance.
 Small Scale Embedded Systems
 Medium Scale Embedded Systems
 Sophisticated Embedded Systems

3.7.1 Small Scale Embedded System


Small Scale Embedded System is normally designed and created using an 8-bit microcontroller.
This microcontroller can be battery activated.

3.7.2 Medium Scale Embedded System


Medium Scale Embedded System uses a single 16-bit or 32-bit microcontroller or multiple
microcontrollers linked together. These systems have a lot of hardware as well as software
complexities, hence are not preferred by many.

3.7.3 Sophisticated Embedded System


Sophisticated Embedded System often function on multiple algorithms that results in
complexities in both hardware and software. They often need a processor that is configurable
and logic array that can be programmed.
Applications of Embedded System

Fig. 4 – Applications of Embedded System

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 21
3.8 Some real-life applications of Embedded Systems
 Consumer electronics – Televisions and digital cameras; computer printers; video game
consoles and home entertainment systems like PS4.
 Household appliances – Refrigerators; washing machines, microwave ovens, air
conditioners
 Medical equipment – Scanners like those for MRI, CT; ECG machines; devices to
monitor blood pressure and heartbeat
 Automobiles – Fuel injection systems, anti-lock braking systems, music and
entertainment systems, controls for air-conditioner
 Industrial applications – Assembly lines, systems for feedback, systems for data
collection
 Aerospace – Systems for navigation and guidance, GPS
 Communications – Routers, satellite phones
Though Mobile phones use embedded system, they operate in a way akin to general purpose
computers; hence not included in the above list.

3.9 Advantages of Embedded System


The advantages of Embedded Systems are:
 They are convenient for mass production. This results in low price per piece.
 These systems are highly stable and reliable.
 Embedded systems are made for specific tasks.
 The embedded systems are very small in size, hence can be carried and loaded
anywhere.
 These systems are fast. They also use less power.
 The embedded systems optimize the use or resources available.
 They improve the product quality.

3.10 Disadvantages of Embedded System


The disadvantages of Embedded Systems are as follows:
 Once configured, these systems cannot be changed. Hence, no improvement or
upgradation on the ones designed and created can be made.
 They are hard to maintain. It is also difficult to take a back-up of embedded files.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 22
 Troubleshooting is difficult for embedded systems. Transferring data from one system
to another is also quite problematic.
 Because these systems are made for specific tasks, hardware is limited.

3.11 Components of the Embedded System


As the embedded system is made up of hardware and software components. In below section
hardware components are described below:
1. Power supply
For the embedded system the power supply is the key component to provide the power to the
embedded system circuit. Usually, the embedded system requires 5 V supply or can be range
from 1.8 to 3.3. V. The power supply source can be battery or can be provided by a wall
adaptor. The power supply is selected as per user requirements and application requirements.
The power supply should be smooth and should be efficient so that continuous power supply
can be provided to an embedded system. The power supply should also allow dissipation and
should be as efficient as possible.

2. Processor
For any embedded system the processor acts as the brain of the system. The processor is
responsible for deciding the performance of the embedded system. In the market there are
multiple types of processors available and can be selected as per user requirement. The
embedded system can act as a microcontroller and microprocessor. The processor can be an 8-
bit processor, a 16-bit processor, and a 32-bit processor. The lesser the bit the smaller the
application is for embedded systems. When large applications are used the higher bit processor
is needed in the embedded system. The processor needs to be very fast, the price should be
minimum, performance should be good so that functions can be performed very fast in an
embedded system.

3. Memory
As there are different microcontrollers is used in the embedded system the memory is present
in the microcontroller itself. There are basically two types of memory RAM(Random access
memory) and ROM (Read-only memory). As the RAM is volatile type memory the data can be
stored temporarily in the memory and when system is switch off the data is lost from the
memory. Read-only memory is classified as code memory. The ROM is used for storing the

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 23
program and when the system is switch on the embedded system fetch code from ROM
memory.

4. Timers counters
In some of the applications there is always a requirement of delay that needed to provide in the
application. For example, in LED display applications there is a requirement of some delay so
that LED can be continuing blink. And for that timer and counter can be used in the embedded
system. The programming can be done in such a way so that delay can be generating the
embedded system. The delay time span can be decided by using the crystal oscillator and
system frequency so that delay can be generated as per user requirement.

5. Communication ports
The communication port is the type of interface that is used to communicate with other types
of embedded systems. In the embedded system there is multiple types of communication ports
like UART, USB, Ethernet, RS-485, and many more. When an embedded system is used in
small scale application then the communication ports can be used from the microcontroller.
There are also serial protocols that can be used for sending data from one system board to
another board.

6. Output and Input


When the embedded system is used the input is needed to interact with the system. The input
to the embedded system can be provided by the sensor or by the user itself. The processor used
in the embedded system can be based on input and output. The proper configuration needs to
be done for using the input and output port. In the embedded system there are fixed input and
output ports so that devices can be connected to that specified ports only. For example, P0, P1,
P2, and many more.

7. Circuits used in application


When the embedded system is design there are several hardware components that can be used
for design purposes. The selection of the circuit is completely dependent on the application used
for the embedded systems. For example, in temperature sensor applications there is a
requirement of temperature sensors for measuring the temperature.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 24
3.12 Hardware Components of the Embedded System
When all the hardware components are selected for an embedded system the next task is to
select software components for designing an embedded system.
1. Assembler
The assembler is sued when the programming language sued for designing the application is
assembly language. The assembly language program is then converted into the HEX code so
that it can be further processed. And after writing the code the programmer is used for writing
the program in the chip.

2. Emulator
An emulator is a software tool that is used to execute the functions of the host system. All the
components can be controlled by the emulator tool. The emulator is also used for finding the
bugs and for debugging code. The emulator also used to transfer the code from the host system
to the target system.

3. Compiler
The compiler is a type of software that is used to convert the programming language into some
language that the target machine can understand and execute the functions. The basic use of the
compiler is to transfer the high-level code into some low-level language. The low-level
languages include machine code, object code, and assembly language.

Conclusion
The embedded system is the type of system that is generally made up of hardware and software
components. There are several hardware components and software components and the
selection of components for designing of embedded system is completely dependent on the
application and user requirements. The higher the number of components more is the cost of
embedded systems and more complex will be the design of an embedded system.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 25
SECTION 4 – iOS ENVIROMENT
4.1 History and Overview of the iOS System
iOS is a mobile operating system developed and distributed by Apple Inc. It was originally
released in 2007 for the iPhone, iPod Touch, and Apple TV. It is the world's second-most widely
installed mobile operating system, after Google’s Android. It is the basis for three other
operating systems made by Apple: iPadOS, tvOS, and watchOS. It is proprietary software,
although some parts of it are open source under the Apple Public Source License and other
licenses.
Major versions of iOS are released annually. The current stable version, iOS 14, was released
to the public on September 16, 2020. It brought many user interface changes, including the
ability to place widgets on the home screen, a compact UI for both Siri and phone calls, and the
ability to change both the default web browser and email apps.

4.2 Features of the iOS System


The power of iOS can be felt with some of the following features provided as a part of the
device:
Maps, Siri, Facebook and Twitter, Multi-Touch, Accelerometer, GPS, High end processor,
Camera, Safari, Powerful APIs, Game center, In-App Purchase, Reminders, Wide Range of
gestures

4.4 Hardware Platform of the iOS System


The main hardware platform for iOS is the ARM architecture and is 64-bit only. It includes a
native 64-bit kernel, libraries, drivers as well as all built-in applications.

4.5 Development Platform of the iOS System


The iOS SDK (Software Development Kit) allows for the development of mobile apps on iOS.
While originally developing iPhone prior to its unveiling in 2007, Apple's then-CEO Steve Jobs
did not intend to let third-party developers build native apps for iOS, instead directing them to
make web applications for the Safari web browser. However, backlash from developers
prompted the company to reconsider, with Jobs announcing in October 2007 that Apple would
have a software development kit available for developers by February 2008. The SDK was
released on March 6, 2008.
The SDK is a free download for users of Mac personal computers. It is not available for
Microsoft Windows PCs. The SDK contains sets giving developers access to various functions
and services of iOS devices, such as hardware and software attributes. It also contains an iPhone

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 26
simulator to mimic the look and feel of the device on the computer while developing. New
versions of the SDK accompany new versions of iOS

4.6 Security and Privacy


Precise location controls: Apple’s iOS 14 comes with technology that allows you to give apps
your approximate location, without revealing exactly where you are.

The ability to change your default browser: While it’s not a privacy or security change per
se—Apple’s Safari browser is pretty good for security and privacy—the ability to change your
default browser in iOS 14 is a welcome change for many.

Indicator light if an app is accessing your camera or microphone: It’s already available on
the Mac, but iOS 14 has now added a new feature that allows you to tell if an app is recording
you using your camera or mic—via an indicator light in the status bar.

Face recognition: FR and scene and object detection are done completely on your device rather
than in the cloud. So Apple doesn’t know what’s in your photos. And apps can access your
photos only with your permission.

Limit Access to Photos and Location: iOS 14 includes a couple of new ways that you can
give apps certain permissions, but only up to a point. The idea is that there are some apps you
trust a bit more than others in terms of looking at your photos or tracking where you are.

Sniff Out Bad Passwords: Apple has been able to sync the passwords and other login
credentials for your various accounts across all of your Apple hardware via iCloud for a while
now; this applies to macOS as well as iOS. To see what Apple has stored in the cloud from your
iPhone, choose Passwords from Settings.

Limit How Apps Track You: Another change in iOS 14 is that apps will have to specifically
request permission to track you across other apps and sites.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 27
SECTION 5 – WEB APPLICATIONS FOR MOBILE PLATFORMS
A web application is application software that runs on a web server, unlike computer-based
software programs that are run locally on the operating system of the device. Web applications
are accessed by the user through a web browser with an active internet connection.

Mobile Web applications also refer to applications for mobile devices that require only a Web
browser to be installed on the device. They typically use HTML and Ajax (and, increasingly,
HTML5 components), although they may make use of augmented rich Internet application
(RIA) technologies, such as Flash, JavaFX and Silverlight, but are not written specifically for
the device.

5.1 Differences between Web, Native and Cross-Platform Apps


Native apps are a great way to create a powerful and responsive product. Web apps are good
for simple projects when you just need to get the job done. Cross-platform apps are something
in between: good for some things, terrible for others. Hybrid mobile apps are applications that
are installed on a device, just like any other app. Hybrid apps are deployed in a native
container that uses a mobile WebView object. When the app is used, this object displays web
content thanks to the use of web technologies (CSS, JavaScript, HTML, HTML5).

Which type is best depends on your goals and ideas. But making the right choice is crucial for
financial and business success. In this article, we look at all three types of mobile apps in
detail. By the end, you’ll have a better grasp of what to expect from these three types of
mobile apps.

5.1.1 Native applications


Native applications are tailored to a specific mobile platform (Android or iOS). Typically,
users get them from app stores.

Native apps are the gold standard of mobile development. Written with platform-specific
approaches and technologies, native apps can show outstanding performance.

Pros:
 Faster than web apps
 Greater functionality as they have access to system resources
 Can work offline

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 28
 Safe and secure — native apps must first be approved by the app store
 Easier to build due to the availability of developer tools, interface elements and SDKs

Cons:
 More expensive to build than web apps
 Compatibility with different platforms (i.e. iOS and Android) usually means designing
and building the app from scratch
 Expensive to maintain and update
 It may prove difficult to get a native app approved by the app store
Example of a native application: Instagram is our top choice as an example of a great native
app. It’s available for both iOS and Android, but these apps are entirely different and are
unique to each system.

5.1.2 Web applications


Web applications are developed as websites using a combination of HTML5 and JavaScript.
These websites are later wrapped in an invisible native WebView container. Some are built
using technologies like Cordova and PhoneGap.

When thinking about a web app, imagine a website turned into a mobile application. That’s
pretty much all there is to them.

Pros:

 Do not need to be downloaded or installed — web apps function in-browser


 Easy to maintain — they have a common codebase regardless of mobile platform
 Will update themselves
 Quicker and easier to build than mobile apps
 Do not require app store approval, so can be launched quickly
Cons:
 Do not work offline
 Slower than mobile apps, and less advanced in terms of features
 May not be as discoverable as mobile apps as they are not listed in a specific database,
such as the app store
 Quality and security is not always guaranteed — web apps don’t need to be approved
by the app store

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 29
Before considering this option though, you should check it out for yourself first. If this is the
sort of experience you’re looking to deliver with your project, then by all means choose a web
app.

5.1.3 Cross-platform applications


Cross-platform apps are easier to develop than native apps, and parts of their code can be
shared across platforms. The advantage of cross-platform applications over web apps is that
they have direct contact with the mobile operating system. They’re usually developed with
Xamarin, React Native, Appcelerator, or NativeScript. However, direct access to the
operating system doesn’t mean full command of everything it has to offer.

Advantages
Shareable code. Certain parts of code (up to 80% at times) can be shared across devices. This
can increase the speed of development, resulting in the need for fewer developers.

High-performance UI/UX. In cross-platform development, the UI and UX are rendered with


native controls. This means that it’s easier to achieve design performance very close to that of
a native app.

Disadvantages
Still requires some native code. Parts of the code for cross-platform apps can be shared
between platforms. However, the parts that cannot be shared still need to be written in a
native language.

Performance concerns. Some parts of cross-platform applications are interpreted on the go.
This influences the overall speed and performance of you application, meaning it will run a
lot slower than a native app.

Frameworks and plugins. Everything within a cross-platform app relies on frameworks and
plugins. This can affect application performance and design since it puts limits on what your
app can do.

Example of a cross-platform application: Facebook Ads Manager is a great example of a cross-


platform application.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 30
Conclusions
It is quite easy to make a choice, it just depend on the aims you are going to reach and the
functionality to empower your mobile application. If the work of your application requires the
devices which maintain a large amount of functionality or information processing rate is very
important (games, social networks, geolocation services, photos exchange services, etc.) you
need to make a native application. If the work speed is not that important, and user needs to
get only information with the mobile Internet, you can absolutely come up with web
application. Web applications should also be used as prototypes to estimate users’ reaction on
your idea and get a certain feedback. This web characteristic is similar to cross-platform
applications. If your interface is not provided for complicated animation and does not perform
calculations, you need to quickly enter the market to test your idea, if you are ready to put up
with interface problems and so on, - cross-platform application will do.

5.2 Tools for building web applications


Web apps tend to be built using JavaScript, CSS and HTML5. Unlike mobile apps, there is no
standard software development kit for building web apps. However, developers do have access
to templates. Compared to mobile apps, web apps are usually quicker and easier to build — but
they are much simpler in terms of features.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 31
SECTION 6 – MOBILE AND WEB APPLICATION DEVELOPMENT PLATFORMS
Mobile apps are more expensive to develop than web apps, and because they are platform-
specific, launching an app across different platforms pretty much means starting from scratch
in terms of design and development. However, they are much faster, and tend to be more
advanced in terms of features and functionality.

Native mobile apps are built using specific languages and Integrated Development
Environments (IDE) depending on the intended platform. Apple devices run on the iOS native
operating system, so Apple apps are built using either Objective-C or Swift, and the Xcode IDE.
Native apps for Android are written in Java and are commonly built using the Android Studio
or Eclipse IDE.

Apple and Google also provide their own development tools, interface elements and software
development kits (SDK) which developers can use to build native mobile apps.

6.1 Some Mobile App Development Frameworks


1. Swiftic
Swiftic is one of the best mobile app development frameworks available in the iOS platform. It
is featured with an easily navigable interface.
Some of the significant features are:

 Interesting push notification


 Become a loyal shopper with a loyalty card
 Build your mobile store
 In-app coupons
 Use scratch cards to win prizes
 Easy Communication
 Menu & Ordering
 Customer Engagement
 App Promotion
 Social & Media Feeds
 App Publication Assistance
 Advanced Analytics
 Third-party integration

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 32
2. Native Scripts
Native Scripts is an open-source framework to create native mobile applications empowered
with Angular, Typescript, JavaScript, CSS, and Vue.js.

Native Script is a preferable framework to reduce the code and time of the app loads on the
system. Many leading companies love using Native Scripts for its strong web empowerment
platform.

Some of the Native Scripts features are:

 Native user interface without WebViews


 Full direct access to Android & iOS APIs
 Cross-platform application
 Mission-critical business support
 Robust backend support

3. React Native
React Native is the best JavaScript library to build native applications for all devices and
platforms. With React Native, you can develop rich applications for both iOS and Android. It
also allows creating platform-specific versions of various components allowing easy using of
single codebase across various multiple platforms. This community-driven JS library was
introduced by Facebook in 2018.

Some of the React Native features are:

 Low-code
 Compatible third-party plugins
 Declarative API for predictive UI
 Supports iOS and Android

4. Xamarin
Xamarin is one of the top mobile app development frameworks and it is .Net based. This native
platform is introduced by Microsoft. Being a cross-platform and open source app building
platform, Xamarin offers a development ecosystem with backend, API, components, etc. It is a
.Net developer platform supported by various tools, libraries, and programming languages.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 33
With Xamarin developers, you can build native applications with the support of an active
community for Android, tvOS, watchOS, iOS, macOS, and Windows.

Some of the Xamarin features are:

 A strong community of 60,000 contributors


 Versatile backend infrastructure
 Diagnostic tools
 Application loader
 Android SDK manager
 Storyboard files
 Google emulator manager

5. Ionic
Ionic helps you to build interactive hybrid and Progressive Web Applications along with cross-
platform applications. This open source framework offers premium services for creating
applications. Ionic covers building applications for the web, Android, and iOS. Besides, while
working in Ionic, you can constantly create applications and ship them to the deployable
locations. Ionic Studio is the lightning version of Ionic and it is quite powerful. You can install
it locally to have an easy visual development environment.

With its out of box features, ionic is always seen as ideal platform over the other mobile app
development frameworks.

Some of the Ionic features are:

 Intuitive UI components
 Faster development time
 Powerful & stable development platform
 Evergreen community of 5 Million developers
 Complete control over app building

6. Adobe PhoneGap
Adobe and Apache together sponsor Adobe PhoneGap which is used widely for Android
development. This top mobile development framework uses HTML5, CSS3 and JavaScript for

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 34
cross-platform development. Core at its heart, Adobe PhoneGap is an open-source desktop
application and you can link the apps to the mobile devices.

Some of the Adobe PhoneGap features are:

 Open Source
 Flexibility
 Compatible on all the platforms
 Ease of Development
 Strong Backend

7. JQuery Mobile
JQuery Mobile is a user interface system based on HTML5. This web is touch-optimized and
used to build highly responsive applications for smartphones, tablets as well as desktops.
JQuery mobile has ThemeRollar offering highly customizable themes. Besides, this top mobile
app development framework enables you to create highly branded websites.

Some JQuery features are:

 Built on JQuery Core


 Lightweight size
 Configured with HTML5
 Automatic initialization
 Powerful theming framework
 Simple API

8. Mobile Angular UI
The Mobile Angular UI is the magical fusion of HTML5, Bootstrap and Angular JS. If you
already know Twitter Bootstrap and Angular JS, you can learn Mobile Angular UI in no time.
This mobile UI framework offers the basic mobile development components that are missing
from Bootstrap 3. Some of these components are overlays, switches, sidebars, scrollable areas,
etc. The fastclick.js and overthrow.js are the prime libraries of Mobile Angular UI.

Some of the Mobile Angular UI features are:

 Build HTML5 hybrid desktop & mobile apps

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 35
 No jQuery dependencies
 Build fully responsive interfaces with a super-small CSS file

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 36
SECTION 7 – INTRODUCTION TO ANDROID PROGRAMMING
Android applications are usually developed in the Java language using the Android Software
Development Kit. Once developed, Android applications can be packaged easily and sold out
either through a store such as Google Play, SlideME, Opera Mobile Store, Mobango, F-droid
and the Amazon Appstore. is an integer value that uniquely identifies the framework API
revision offered by a version of the Android platform.

7.1 Prerequisites of Android Programming


1. Basic Knowledge About Programming
To learn any technology, one has to know about programming means one has to know about
what is functions or methods, what is variables and how to use them to get a fruitful result, and
some little bit about data structures like arrays, linked lists, etc.

2. Learn Java or Kotlin


To develop an android app you have to write code in Java or Kotlin. You have to learn any of
these languages to communicate with android studio and make an app. Without Java or Kotlin,
it’s not possible to make an android app. Both languages are Object-Oriented Programming
Language.

Java or Kotlin?
 Java:
o Pros:
 Java is a very old language so one can find too many resources to learn
that language, also if you stuck somewhere you can easily find the
solution by googling it.
 If you are a computer science student you have to learn java because it’s
in the syllabus.
 I think in java one can more deeply understand the oops concepts (which
is mentioned in the 3no. column) and understanding oops are very much
important.
o Cons:
 With java, you have to write a lot of code.
 With java one have to write too much code to perform some operations
but in Kotlin it has some inbuilt feature to handle those tasks.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 37
 Kotlin:
o Pros:
 Google declared Kotlin as an official language for android development.
 Most of the companies are switching to Kotlin from java.
 One has to write lesser code in Kotlin compare to java.
 Kotin has some features that can handle a critical task in very lesser code.
o Cons:
 There are not any such disadvantages of Kotlin.

Personal Opinion: No doubt Kotlin the best language for android development there is nothing
to argue about. If you started android development with java, you have to shift it to Kotlin one
day. But In my opinion, If anyone can understand an object-orientated programming language
properly, It’s very easy for his/her to learn another language. Coding and started learning with
java may be harder than Kotlin but with java one can learn the core concepts more deeply and
also can get more resources than Kotlin and If one can learn the main concepts properly then
learning Kotlin and started development in Kotlin is a very easy task for him/her. In the end,
language is just a way to execute ideas.

3. Concepts of OOPs (Object Oriented Programming)


OOP concepts are the concepts of objects. Making an android app is so easy but making a real-
world app with android is not only make an app it’s many more. When you come to know about
the core concepts of android, you have to understand those concepts properly. For learning
those core concepts you first need to OOP concepts. In OOP, there are 4 main concepts means
you have to learn

1. Encapsulation: Encapsulation is a way of wrapping up the data in a single unit and


prevent the data accessed outside of the wrap.
2. Abstraction: Abstraction is a way to hide nonessential information and show only
essential ones.
3. Inheritance: As you can see its name it’s a way to inherit the properties of other classes.
With that, you can use all features of a class to build other classes.
4. Polymorphism: As polymorphism means it can uses classes and perform them in
different ways. With that, an inherited class can act in different ways.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 38
7.2 Android Studio Environment Installation And Configuration
You will be required to download the necessary tools, SDKs and setup files to setup the
environment for development. You can use a macOS, Windows or a Linux platform for your
Android Application Development. All required packages, tools and other required files can be
downloaded from the internet. Following are the names of the files, along with their descriptions
that you will be required for developing Android apps.
a) Java Development Kit(JDK)
Android SDK works on Java SE Development Kit(JDK). Therefore, first your system must
have JDK installed. If you don't have it on your system, you can download it from here.
Note: Make sure you download proper JDK based upon your system configurations as there
are separate setup files for macOS, Windows and Linux platform.

So the first requirement for setting up the environment is that JDK must be installed on your
system. Once you are done with this, you can go for the next step.

b) Android SDK/Android Studio/Eclipse


Next comes Android SDK. It contains libraries, debugger, an emulator, documentations, sample
codes and tutorials for each of the released versions of Android.
Note: Before the release of Android Studio, SDK was a standalone part of the Android
Application development tools that could be integrated with other IDE's like Eclipse with the
help of Android ADT Bundle. Later on, Google made Android SDK as a part of the Android
Studio, which is the official IDE for Android development.

You can download the complete Android Development Environment bundle(Android Studio +
SDK) from the link here.

c) Setup and Installation of Android Studio


Once you have finished with installing JDK and downloading Android Studio IDE setup file,
double click on the .exe file (setup file) of the Android Studio. It'll prepare the file for setup and
will ask you for the location where you want to install it, as shown in image below.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 39
Select an appropriate location and click on Next button.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 40
Click on Install button. It will start installing as shown below.

Click on Next button. Android Studio has been installed directly and it is ready for use. Click
on finish button and Android Studio will open. Android Studio will automatically get the
location of the Android SDK if it is in the same location as itself. But if it fails to discover, then
it'll ask you to browse to the Android SDK's location.

7.3 SDK MANAGER


The Android SDK Manager, manages various Android SDK versions, tools and various other
useful packages that you can select and download, to keep your development environment up-
to-date.

Generally when you launch the Android Studio for the first time, it will open the Android SDK
Manager window, to prompt you to install the required packages for android development. But
if that does not happen, you can open the SDK Manager by going to Tools → Android → SDK

Manager or click on the icon in the Android Studio toolbar.

Launch your SDK Manager, and you'll get to see the list of currently installed items. It will also
list all the new items & Updates available for already installed items for your system. From

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 41
here, you can check the required Build tools, SDK Tools, Platform Tools, SDK Platforms,
Samples for SDK, System Images (for AVD), Documentations, Sources for Android SDK and
Extra Packages for your development. It requires internet connection to download the packages
(most are of large size) so make sure you have one.

 SDK Tools and Build-tools contain packages to build your Android Application and
several updates/patches from Google for better Application Development.
 For specific (version) of Android, you have to download additional packages from the
section SDK Platforms. You can easily understand which API Level/Android Version
you want to install, as there is a list with Android version names listed, you just have to
select one and click on OK. In the previous image, you can see some packages of 22
that we have installed on our system, and there is also Update available for it. So lets
see which packages do we have to install onto our machine:
1. SDK Platform: Android SDK platform contains packages/libraries to develop
& build Android Application for specific versions. To compile your Application
against specific version, to load specific widgets, views and tools for
compilation, is done by SDK Platform. Hence, whenever you want to download

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 42
packages for any new Android version like 8.0 or 7.0, always select and
download SDK Platform for it.
2. System Image: To create an AVD(Android Virtual Device) for any specific
API, you should download a System Image as per your system type (either 32-
bit or 64-bit OS). For Android Smart Phone, Wear & TV, separate images are
required which are also available for downloading. If your application is
working with some play-service features like Google MAPs and all, then to test
your application with them, you've to download Google API System Image as
well.
3. Optional Packages: Samples for SDK, Sources for Android SDK &
Documentation for an are optional. SDK manager also lets you download few
samples for any particular SDK platform and Source for API level. If
Documentation is there, you can download the documentation that contains
information about specific classes and methods for that API level. If you require
them, then you can select them for download else don't.
4. Scroll down in SDK Manager, and you will see Extras section, which contains
additional packages/libraries/services that are required/helpful for application
development. You can download, if you think you need any. As of now, we
advice you to ignore them.

We hope you've selected your required tools and packages to install, click on OK or Install.
This will open another window as shown in below image, select the Accept License radio
button and then click on Install Packages button in the lower right corner of the SDK Manager
window, this will start downloading your selected packages. The installation will take time, so
be patient. You'll be asked to restart the ADB when all packages get installed in your system,
Click YES for it.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 43
This is all about the SDK Manager. In one line:

It lets you download your required Android Version Packages and Tools for Application
Development".

7.4 Creating Android Virtual Device with AVD Manager


We will learn what is AVD Manager and how you can we create an AVD (Android Virtual
Device) to test your first android application. An Android Virtual Device (AVD) is a device
configuration that runs on the Android Emulator. It provides virtual device-specific Android
Environment in which we can install & test our Android Application. AVD Manager is a part
of SDK Manager to create and manage the virtual devices created.

To open AVD manager, go to Tools → Android → AVD Manager as shown in below image.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 44
It will open AVD Manager with a list of created virtual devices as shown in below image. It
may be empty for you now as you haven't created any device as of now. To create a new device,
click on Create Virtual Device button at the bottom-left corner.

It will open a window to Select Hardware type for your virtual device. This list contains almost
all the Android devices with their respective settings. Select any one out of all the devices listed,
with your required configuration (like Size of the screen, Resolution and Density) and click on
Next.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 45
Next you will be asked to select System Image that will be the running Android Version for
your newly created virtual device. You can choose any Android system images that are already
available in your Android Studio, or Download the one you want, by clicking on the Download
option available with the names. Recommended section will list the best choices available as
per the latest updates available. x86 Images contain images that are mostly used and Other
Images section contain system images with Google Play Services. Choose as per your required
configuration (We've selected 21). Click on Next once you are done.

7.5 Android - Application Components


Application components are the essential building blocks of an Android application. These
components are loosely coupled by the application manifest file AndroidManifest.xml that
describes each component of the application and how they interact.

There are following four main components that can be used within an Android application −

Sr.No Components & Description


1 Activities

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 46
They dictate the UI and handle the user interaction to the smart phone screen.
2 Services
They handle background processing associated with an application.
3 Broadcast Receivers
They handle communication between Android OS and applications.
4 Content Providers
They handle data and database management issues.
Activities
An activity represents a single screen with a user interface, in-short Activity performs actions
on the screen. For example, an email application might have one activity that shows a list of
new emails, another activity to compose an email, and another activity for reading emails. If an
application has more than one activity, then one of them should be marked as the activity that
is presented when the application is launched.

An activity is implemented as a subclass of Activity class as follows −


public class MainActivity extends Activity {
}
Services
A service is a component that runs in the background to perform long-running operations. For
example, a service might play music in the background while the user is in a different
application, or it might fetch data over the network without blocking user interaction with an
activity.

A service is implemented as a subclass of Service class as follows −


public class MyService extends Service {
}

Broadcast Receivers
Broadcast Receivers simply respond to broadcast messages from other applications or from the
system. For example, applications can also initiate broadcasts to let other applications know
that some data has been downloaded to the device and is available for them to use, so this is
broadcast receiver who will intercept this communication and will initiate appropriate action.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 47
A broadcast receiver is implemented as a subclass of BroadcastReceiver class and each
message is broadcaster as an Intent object.

public class MyReceiver extends BroadcastReceiver {


public void onReceive(context,intent){}
}

Content Providers
A content provider component supplies data from one application to others on request. Such
requests are handled by the methods of the ContentResolver class. The data may be stored in
the file system, the database or somewhere else entirely.

A content provider is implemented as a subclass of ContentProvider class and must implement


a standard set of APIs that enable other applications to perform transactions.

public class MyContentProvider extends ContentProvider {


public void onCreate(){}
}

We will go through these tags in detail while covering application components in individual
chapters.

Additional Components
There are additional components which will be used in the construction of above mentioned
entities, their logic, and wiring between them. These components are −
S.No Components & Description
1 Fragments
Represents a portion of user interface in an Activity.
2 Views
UI elements that are drawn on-screen including buttons, lists forms etc.
3 Layouts
View hierarchies that control screen format and appearance of the views.
4 Intents
Messages wiring components together.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 48
5 Resources
External elements, such as strings, constants and drawable pictures.
6 Manifest
Configuration file for the application.

Next window will list down all the configured settings for final verification. Here, you can give
your AVD a name for identification, can change device type and API configuration and can
also setup size, orientation as well as Graphics for your AVD.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 49
Click on Show Advanced Settings and you will see more advanced settings for your virtual
device as shown in image below. Here you have settings for Camera, Network, Memory (RAM
& Heap) and Storage (Internal & External) and Virtual Device Frame.

You can configure your device as per your requirements and click on Finish. Android Studio
will immediately start building AVD with the selected configurations & might take some time.
When it completes, AVD Manager will list out your virtual device in the available devices list
as shown in below image.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 50
From the Action column(last column of the table), you can perform several actions like Launch
AVD and Edit AVD configurations etc. Launch your first AVD by clicking Start icon(green
play icon). It will start a Virtual Device just like an Android Device as shown in below image.
Side toolbar contains buttons to perform actions like volume up-down, change orientation, go
back, go to home or recent & more. You can also turn the power off for the virtual devices using
the power button and to close the virtual device select close button.

Now you have your own Android Virtual Device running on your system where you can test
various Android Application Projects. You can have more than one virtual devices in your AVD
manager as per your project requirements. Similarly you can also create AVD for devices like
Android TV and Android Wear for testing.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 51
SECTION 8 – MY FIRST ANDROID APPLICATION
In the previous sections, we learned how we can setup our system for Android Application
Development and how to create an AVD(Android Virtual Device) to test our applications. So
now in this tutorial, we will be creating our first Android Application and will try to understand
the basics of Android Application development.

8.1 App Basics


Our first application will be a simple application with one activity and a layout, in which we
will just print Hello World! on the device screen. Here are a few things that you must know,
don't worry about it, you will understand all these, as we move forward:

 An activity is an instance of Activity, a class in the Android SDK. An activity is


responsible for managing user interaction with a screen of information. Whenever we
create a new activity, we are actually writing a subclass of Activity class. A simple
application may need only one subclass, while a complex application can have many.
In our first application FirstAppActivity will be our activity subclass.
 A layout defines a set of user interface(UI) objects(Views and Widgets) and their
position on the device screen. A layout is made up of definitions written in XML. Each
definition is used to create an object(a user interface) that appears on the device's screen,
like a button or some text or an image.

In simple words we can say, that the backend will be handled by the class which extends the
Activity class, and the frontend i.e. the User interface is defined in the layout XML file.

8.2 Hello World! Android Application


The first step is to create a simple Android Application using Android studio. When you click
on Android studio icon, it will show screen as shown below

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 52
You can start your application development by calling start a new android studio project. in a
new installation frame should ask Application name, package information and location of the
project.−

After entered application name, it going to be called select the form factors your application
runs on, here need to specify Minimum SDK, in our tutorial, I have declared as API23: Android
6.0(Mashmallow) −

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 53
The next level of installation should contain selecting the activity to mobile, it specifies the
default layout for Applications.

At the final stage it going to be open development tool to write the application code.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 54
8.3 Anatomy of Android Application
Before you run your app, you should be aware of a few directories and files in the Android
project −

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 55
Sr.No. Folder, File & Description
1 Java
This contains the .java source files for your project. By default, it includes an
MainActivity.java source file having an activity class that runs when your app is
launched using the app icon.
2 res/drawable-hdpi

This is a directory for drawable objects that are designed for high-density screens.
3 res/layout

This is a directory for files that define your app's user interface.
4 res/values

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 56
This is a directory for other various XML files that contain a collection of resources,
such as strings and colours definitions.
5 AndroidManifest.xml

This is the manifest file which describes the fundamental characteristics of the app
and defines each of its components.
6 Build.gradle

This is an auto generated file which contains compileSdkVersion,


buildToolsVersion, applicationId, minSdkVersion, targetSdkVersion, versionCode
and versionName

Following section will give a brief overview of the important application files.

8.4 The Main Activity File

The main activity code is a Java file MainActivity.java. This is the actual application file which
ultimately gets converted to a Dalvik executable and runs your application. Following is the
default code generated by the application wizard for Hello World! application −
package com.example.helloworld;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}

Here, R.layout.activity_main refers to the activity_main.xml file located in the res/layout folder.
The onCreate() method is one of many methods that are figured when an activity is loaded.

8.5 The Manifest File


Whatever component you develop as a part of your application, you must declare all its
components in a manifest.xml which resides at the root of the application project directory. This
file works as an interface between Android OS and your application, so if you do not declare

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 57
your component in this file, then it will not be considered by the OS. For example, a default
manifest file will look like as following file −
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tutorialspoint7.myapplication">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Here <application>...</application> tags enclosed the components related to the application.


Attribute android:icon will point to the application icon available under res/drawable-hdpi. The
application uses the image named ic_launcher.png located in the drawable folders

The <activity> tag is used to specify an activity and android:name attribute specifies the fully
qualified class name of the Activity subclass and the android:label attributes specifies a string
to use as the label for the activity. You can specify multiple activities using <activity> tags.

The action for the intent filter is named android.intent.action.MAIN to indicate that this activity
serves as the entry point for the application. The category for the intent-filter is named
android.intent.category.LAUNCHER to indicate that the application can be launched from the
device's launcher icon.

The @string refers to the strings.xml file explained below. Hence, @string/app_name refers to
the app_name string defined in the strings.xml file, which is "HelloWorld". Similar way, other
strings get populated in the application.

Following is the list of tags which you will use in your manifest file to specify different Android
application components −

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 58
 <activity>elements for activities
 <service> elements for services
 <receiver> elements for broadcast receivers
 <provider> elements for content providers

8.6 The Strings File


The strings.xml file is located in the res/values folder and it contains all the text that your
application uses. For example, the names of buttons, labels, default text, and similar types of
strings go into this file. This file is responsible for their textual content. For example, a default
strings file will look like as following file −
<resources>
<string name="app_name">HelloWorld</string>
<string name="hello_world">Hello world!</string>
<string name="menu_settings">Settings</string>
<string name="title_activity_main">MainActivity</string>
</resources>

8.7 The Layout File


The activity_main.xml is a layout file available in res/layout directory, that is referenced by
your application when building its interface. You will modify this file very frequently to change
the layout of your application. For your "Hello World!" application, this file will have following
content related to default layout −

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:padding="@dimen/padding_medium"
android:text="@string/hello_world"
tools:context=".MainActivity" />

</RelativeLayout>

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 59
This is an example of simple RelativeLayout which we will study in a separate chapter. The
TextView is an Android control used to build the GUI and it have various attributes like
android:layout_width, android:layout_height etc which are being used to set its width and
height etc.. The @string refers to the strings.xml file located in the res/values folder. Hence,
@string/hello_world refers to the hello string defined in the strings.xml file, which is "Hello
World!".

8.8 Running the Application


Let's try to run our Hello World! application we just created. I assume you had created your
AVD while doing environment set-up. To run the app from Android studio, open one of your
project's activity files and click Run icon from the tool bar. Android studio installs the app
on your AVD and starts it and if everything is fine with your set-up and application, it will
display following Emulator window −

Congratulations!!! you have developed


your first Android Application and now
just keep following rest of the tutorial
step by step to become a great Android
Developer. All the very best.

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 60
SECTION 9 – ANDROID CODENAMES, TAGS AND BUILD NUMBERS
Codename Version API level
Android11 11 30
Android10 10 29
Pie 9 28
Oreo 8.1.0 27
Oreo 8.0.0 26
Nougat 7.1 25
Nougat 7.0 24
Marshmallow 6.0 23
Lollipop 5.1 22
Lollipop 5.0 21
KitKat 4.4 - 4.4.4 19
Jelly Bean 4.3.x 18
Jelly Bean 4.2.x 17
Jelly Bean 4.1.x 16
Ice Cream Sandwich 4.0.3 - 4.0.4 15
Ice Cream Sandwich 4.0.1 - 4.0.2 14
SECTION 10 – ANDROID LAYOUTS AND HOW TO USE THEM
 Linear Layout
 Relative Layout
 Table Layout
 Absolute Layout
 List Layout
 Grid Layout
 Frame Layouts

SECTION 11 – ANDROID CONTROLS AND EVENT HANDLERS


 Buttons
 TextViews
 EditText
 ImageButton
 CheckBox
 Spinner
 RadioButton
 Creating UI controls
 onclick() events
 onTouch() events
 onFocuChange() events

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 61
SECTION 12 – ANDROID AND DATABASE
Read More on Android
1. https://www.tutorialspoint.com/android/index.htm
2. Erik Hellman. Android Programming: Pushing the Limits.1st Edition,Kindle Edition
3. Mark L Murphy (2011) The Busy Coder's Guide to Advanced Android Development
SECTION 13 – GROUPS ON ANDROID DEVELOPMENT

GROUP 1
ID NAME
1
YILA ROY
2
NTOMB WILLS SMITH

GROUP 2
3
ABONGNELAH NEBA JNR
4
ESSOH LANDRY MANFRED

GROUP 3
5
FOTSO INGRID METCHUM
6
JELE GRAIG

GROUP 4
7
ISMAEL HASSAN
8
NDIKUM ELIZABETH

GROUP 5
9
SIAKAM FRANCIS
10
WANDJI GHISLAIN

GROUP 6
11
ANSHU. N WILLIAMS
12
TCHOUTEZO KANA JENIFER

GROUP 7
13
LACMAGO ULRICH
14
JIJONG STANLEY

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 62
GROUP 8
15
KAMDEM AUDREY
16
SMITH NGONJA NDOKE

SECTION 14 – ANDROID PROJECTS


No. PROJECT TITLE PROJECT DESCRIPTION
1 Hello App ! This app takes a user’s name and displays in on a Toast, same
activity and on a button.
2 Simple Calculator Has 2 TextViews and accepts 2 numbers and performs a
selected operation and displays the answer on a Toast.
3 Simple Form This app should be able to perform all calculator basic
functions (BODMAS).
4 Unit Converter This application should be able to convert the following units:
cm-m, g-kg, cl-l
5 Countdown and The app should be able to launch a countdown and stopwatch
Stopwatch based on what the user wants. It should have a home page and
2 buttons (countdown and stopwatch) which opens when the
user clicks on.
6 Google Map The app should have a button that when you click on it, it
opens Google map in the app and shows your current location.
The user can click on another button GET COORDINATES to
return the current coordinates.
7 Camera, Storage The app should be able to take a photo with your camera and
and Upload save in your phone. The App should have a SHARE button
that can also share the image to another app.
8 Database 1 This app should be able to register a user using name, email,
date of birth, telephone, photo, region of origin, sex and saves
the information into a database.
9 Android CRUD Create any App of your choice that perform CRUD
operations. The app MUST have the following: tables, lists,
spinner, menus, tables, progress bar, date picker. This login
section should pass a user’s name as parameter to all the other
activities and the user’s name can be displayed on the top of
ALL the other activities.
10 Web App + Push The admin can send a message from the web application and
Notification the message is saved in the database and appears as a Push
Notification on the Android App.

COURAGE AND GOODLUCK MY FUTURE ENGINEERS

IUGET/2020-2021/HND/200/PROGRAMMING_OF_MOBILE_TERMINALS 63

You might also like