Chapter 2 Mobile Application Development
Chapter 2 Mobile Application Development
Introduction to
Mobile Application Development
Compiled By:
Kasaye A.
What is Android?
Android is an open source and Linux-based Operating System for mobile devices such as
smartphones and tablet computers. Android was developed by the Open Handset Alliance, led by
Google, and other companies.
Android offers a unified approach to application development for mobile devices which means
developers need only develop for Android, and their applications should be able to run on different
devices powered by Android.
The first beta version of the Android Software Development Kit (SDK) was released by Google in
2007 where as the first commercial version, Android 1.0, was released in September 2008.
On June 27, 2012, at the Google I/O conference, Google announced the next Android version, 4.1
Jelly Bean. Jelly Bean is an incremental update, with the primary aim of improving the user interface,
both in terms of functionality and performance.
The source code for Android is available under free and open source software licenses. Google
publishes most of the code under the Apache License version 2.0 and the rest, Linux kernel changes,
under the GNU General Public License version 2.
Why Android ?
Features of Android
Beautiful UI: Android OS basic screen provides a beautiful and
intuitive user interface.
Connectivity: GSM/EDGE, IDEN, CDMA, EV-DO, UMTS,
Bluetooth, Wi-Fi, LTE, NFC and WiMAX.
Storage: SQLite, a lightweight relational database, is used for data
storage purposes.
Media Support:H.263, H.264, MPEG-4 SP, AMR, AMR-WB,
AAC, HE-AAC, AAC 5.1, MP3, MIDI, Ogg Vorbis, WAV, JPEG,
PNG, GIF, and BMP.
Messaging: SMS and MMS[Multimedia Message Service]
Web browser: Based on the open-source WebKit layout engine,
coupled with Chrome's V8 JavaScript engine supporting HTML5
and CSS3.
Multi-touch: Android has native support for multi-touch which
was initially made available in handsets such as the HTC Hero.
Features of Android…
Multi-tasking: User can jump from one task to another and
same time various application can run simultaneously.
Resizable widgets: Widgets are resizable, so users can
expand them to show more content or shrink them to save
space.
Multi-Language: Supports single direction and bi-
directional text.
GCM: Google Cloud Messaging (GCM) is a service that lets
developers send short message data to their users on Android
devices, without needing a proprietary sync solution.
Wi-Fi Direct: A technology that lets apps discover and pair
directly, over a high-bandwidth peer-to-peer connection.
Android Beam: A popular NFC-based technology that lets
users instantly share, just by touching two NFC-enabled
phones together.
Open Handset Alliance (OHA)
The Open Handset Alliance (OHA) is a association of 84 firms [organizations] to develop
open standards for mobile devices. Member firms include Google, HTC, Sony, Dell, Intel,
Motorola, Qualcomm, Texas Instruments, Samsung Electronics, LG Electronics, T-Mobile,
Sprint Corporation, Nvidia, and Wind River Systems
Linux version 2.6.x for core system services.
Provides proven driver model.
Provides: memorymanagement, process
management, security model, networking and lot of
core OS infrastructure
Libc:c standard library
SSL: Secure Socket Layer
Surface Manager:
responsible for
composing different
drawing surfaces onto the
screen.
OpenGL|ES : 3D Image Engine
SGL : 2D image Engine.
Hence we can combine 3D and 2D graphics in the same application.
Media Framework : Core part of the android multimedia.
MPEG4,H264,MP3,AAC…..
• CORE LIBRARIES:
Java Programming Language
contains all the collection classes, utilities, IO..all these utilities which you come
across and expected to use.
iO
Apps S
Hardware
The Layers in iOS Architecture Technology
iCloud Storage
lets your application write data to a central location and access those
items from all user’s computers and iOS devices
Core services framework
Includes Accounts.framework, AddressBook.framework and
CoreData.framework for user accounts ,contacts and for managing
model-view-controller application
iCloud
Media Layer
The Media layer contains the graphics, audio, and video technologies
Graphics Technologies
Supports rich audio experince and audio formats like AAC, Apple
Lossless(ALAC),A-Law and Linear PCM
Video technologies
The iOS support the playback of movie files with the .mov, .mp4, .m4v,
and .3gp filename extensions
Compression standards in Video Technologies
The Cocoa Touch layer contains the key frameworks for building iOS
applications
framework. App interface is the first thing a user sees and interacts with.
From the user perspective, this framework keeps the overall experience
blocks that can be used to build complex and consistent user interface
(API).
All apps
Recent screen
The home screen is the “landing” area when we power our phone on. This
interface is highly customizable and themed. Using widgets we can create and
personalize our “home” screen. All apps is the interface where the app installed
are displayed, while recent screens are the list of last used apps.
Android App Structure and UI patterns
Android apps are very different from each other because
they try to address different user needs.
There are simple apps with a very simple UI that has just
only one view and there are other apps much more
complex with a very structured navigation and multiple
views.
In general, we can say an Android app is made by a top-
level view and detail/level view. Slide no-4
One of the biggest efforts made by Google was to define
a well defined set of rules that helps developers to create
appealing user interfaces. At the same time, these rules
help users to navigate through every app in the same way.
We call this UI consistency.
Android App Structure and UI patterns…
Android, moreover, guarantees to the developers the
required flexibility to customize the app look and feel and
make it unique.
These rules are known as UI patterns. Patterns are proven
solution approaches to well known problems. Thus, having a
well defined UI pattern catalog and knowing when and
where apply them, we can create appealing apps that are not
only full of interesting features but they are enjoyable by
users and easy to use.
Top level view
The top level view is the “landing” area of our app, This is the first thing
an user sees of our app. There are some specific patterns that can be
applied when designing this view depending on the type of information
we want to show:
Fixed tabs
Spinner
Navigation drawer
We can use
1. fixed tabs when we want to give to the user an overview of the different
views present in our app, so that a user can switch easily between them to
show different type of information. A typical example is a app that shows
tech news: in this case we could use different tabs to group news like
(‘Android’, iOS, ‘Games’ and so on).
2. Spinner is used when we want to move directly to a specific view,
this is the case of a calendar app when we can use spinner to go
directly to a specific month.
3.The navigation drawer is one of the newest patterns introduced by
Google. This is a sliding menu, usually at the left side of the
Smartphone screen, that can be opened and closed by the user.
Detail view : The detail view is a low level view where a user can
interact with data directly. It is used to show data and edit them.
Action Bar : An action bar is a piece of the screen, usually at the
top, that is persistent across multiple views. It provides some key
functions:
App branding: icon area
Title area
Key action area
Menu area
Standard Components
How do we build a user interface? Android gives some key
View: It is the base class for all visual components (control and
View group: A View Group can contain one or more Views and
defines how these Views are placed in the user interface (these are
used along with Android Layout managers.
Standard Components…
we can extend them and create a custom control with a custom layout and
behavior. Using these four components and following the standard UI patterns
we can create amazing apps that are “easy-to-use
Android provides some standard UI components that can be grouped in:
Tabs
Spinners
Pickers
Lists
Buttons
Dialogs
Grid lists
TextFields
If we analyze in more detail an Android user interface has an hierarchical
structure where at the root there’s a ViewGroup. A ViewGroup behaves like an
invisible container where single views are placed following some rules. We can
combine ViewGroup with ViewGroup to have more control on how views are
located.
If we create a simple android app, using our IDE, we can verify the
UI structure
From the example above, we can notice that at the top of the hierarchy there is a
ViewGroup (called Relative Layout) and then there are a list of view child (controls and
widgets).
When we want to create an UI in Android we have to create some files in XML format.
Android is very powerful from this point of view because we can “describe” our UI interface
just in XML format. The OS will then convert it in a real code lines when we compile our
app and create the apk.
Managing Application data
Application data comes from various sources, such as user-
generated inputs, operating system data, data received from the
Web, and application-produced data. Some of the application data
is transient, and you don’t need to save it in persistent storage,
such as a Secure Digital (SD) card or device memory, or to save it
on the Web; but other data may need to be persisted either in local
data storage or to the Web so
Generally, you have control over a few data storage design
decisions when creating a mobile application:
Where to save the data
What format to save the data in
How data is shared between applications
Managing Application data…
Historically, mobile applications on major software
platforms usually have saved data locally on the
device. For example, on Windows Mobile devices an
application can use the registry to save some
application-specific settings and use file system APIs
to save other data to either the application can access
it later.
Device memory or an SD card. The iPhone Operating
System (iOS) and Android both provide APIs to save
data locally and privately — only the application can
access its data
Local and Cloud
Mobile applications commonly combine local and cloud data as part of the data
usage model. Sometimes this is the only viable approach, because the cloud
data, such as RSS feeds, isn’t under the developer’s control. When an
application is running, it can store its data completely in memory when the data
size isn’t too large. If the data becomes too large to store in memory, the
application relies on persistent storage on the device.
In both cases, the application can communicate with cloud storage or a web
service provider to download the latest data, as well as upload updates to the
cloud or web service. Communication of this sort generally requires a
synchronization framework that developers can use to build both the device-
side and cloud-side applications to ensure data consistency without worrying
about a data connection and synchronization management.
Local and Cloud…
Android provides a synchronization service and a
SyncAdapter class that developers can use to build data
synchronization with cloud storage (the server). By
extending the AbstractThreadedSyncAdapter class and
implementing the onPerformSync(Account, Bundle, String,
ContentProviderClient, SyncResult) method, the system’s
sync service can perform the specifi ed data sync operations
Local Files and Databases
Local Files and Databases
When an application has smaller data requirements (usually in the form of key-
value pairs), all it really needs is a custom file or an XML file to save them. The
application simply implements data serialization and de-serialization to and from
the file.
Android provides standard Java file system methods such as FileOutputStream()
and FileInputStream() to access the application’s private storage. Developers can
use the android.utils.Xml class or Simple API for XML (SAX) in the org.xml.sax
namespace and the javax. xml.parsers namespace to parse XML fi les.
In addition to using custom files or XML files, using a SQL database engine is a
natural choice for applications that employ a complex data model. The advantages
of using a SQL database to store and access data are:
A database manages structured data and enables flexible access.
A database maintains consistent data with schemes and transactions.
Applications can leverage easy-to-use SQL commands to query and update
data.
A database provides good query and update performance.
A database provides enhanced data security.
Integrating Cloud Services
cloud computing means many things. for mobile app developers, it provides the ability
to build aap that the millions of people can use. Cloud computing makes it easier to
handle large and growing number of users . A mobile cloud application is a software
program that is designed to be accessed over the internet by many types of portable
computing devices.
Traditionally, software application needed to be purchased upfront &then installed it onto your computer.
SaaS users on the other hand, instead of purchasing the software subscribes to it, usually on monthly basis
via internet.
Anyone who needs an access to a particular piece of software can be subscribe as a user, whether it is one
or two people or every thousands of employees in a corporation. SaaS is compatible with all internet
enabled devices
PaaS (Platform as a Service)
Platform as a service, is referred as PaaS, it provides a platform and environment to allow developers to build
applications and services.This service is hosted in the cloud and accessed by the users via internet.
To understand in a simple terms, let compare this with painting a picture, where you are provided with paint
colors, different paint brushes and paper by your school teacher and you just have to draw a beautiful picture
using those tools.
PaaS services are constantly updated & new features added. Software developers, web
developers and business can benefit from PaaS. It provides platform to support
application development. It includes software support and management services,
storage, networking, deploying, testing, collaborating, hosting and maintaining
applications.
IaaS (Infrastructure as a Service)
IaaS (Infrastructure As A Service) is one of the fundamental service model of cloud
computing alongside PaaS( Platform as a Service). It provides access to computing
resources in a virtualized environment “the cloud” on internet. It provides computing
infrastructure like virtual server space, network connections, bandwidth, load balancers
and IP addresses. The pool of hardware resource is extracted from multiple servers and
networks usually distributed across numerous data centers. This provides redundancy and
reliability to IaaS.