0 ratings0% found this document useful (0 votes) 59 views32 pagesMobile Application (Unit I)
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
I e—F=, EE F—E__ _ ————_ E—E
UNIT-1
a
Introduction to Mobile
Applications
—wsw —_———————
Native and web applications - Mobile operating systems and
applications - Mobile Databases. Android: History of Android -
Android Features — OSS — OHA - Android Versions and compatibility
- Android devices - Prerequisites to learn Android — Setting up
software — IDE - XML. Android Architecture: Android Stack - Linux
Kernel - Android Runtime - Dalvik VM - Application Framework -
Android emulator - Android applications.
1.1 NATIVE MOBILE APPS
Native apps are developed specifically for a particular mobile
device and are installed directly onto the device itself. Users download
the app via app stores such as Apple App Store, Google Play store, etc.
Native apps are built for specific mobile operating system such
as Apple iOS or Android OS. An app made for Apple iOS will not
work on Android OS or Windows OS. So if you want your app to work
across all major mobile operating systems, you must build separate
apps for each operating system. This means more money and more
effort (time, resources).
Before deciding whether to build a native app, you need to know
the Pros and Cons of such an approach.Mobite Application Developmen,
Pros
ai offline, which makes them faster to open ang
© They
es, the performance is faster because they store
mchronize with the server after
the user is done using the app.
© Theyallowtheusertouse device-specifichand gestures. Android
and iOS are gradually developing different conventions for
interaction, and a native app responds the way its user expects,
© Native apps get the approval of the app store they are intended
‘most of the time the user can be assured of
for, which
rove safety and security of the app.
© They allow direct access to device hardware that is either
more
accelerometer, etc.)
difficult or impossible with a mobile app (camera,
Cons
@ More expensive to develop, especially when the app needs to
multiplying the development costs
% Cost of app maintenance is higher (especially if this app
supports more than one mobile platform).
Getting the app approved for the various app stores can prove
to be long and tedious for the developer
% Use of the app is contingent on the user's willingness 10
download and install the app onto their mobile device
compatible with multiple mobile operating systems, thus
Introduction to Mobite Applications 13
4.2 MOBILE WEB APPS.
Web Apps are basically inigrnet-enabled applications that are
accessible via the mobile device's Web browser. Users don’t need to
downloaded and install the app onto mobile device in order to access it
‘The app is written as web pages in HTML and CSS, with the
interactive parts in Jquery, JavaScript or similar language. Meaning
that single web app can be used on most devices capable of surfing the
web, regardless ofthe operating system they use.
Let's see what the Pros and Con’ of a mobile web app.
Pros
They are instantly accessible to users via a browser across a
+
range of devices (iPhone, Android, Windows, etc).
‘They are much easier to update or maintain by the developer. If
‘you want to change the design or content of a mobile web app,
‘you simply publish the update to the server and the changes are
immediately visible.
% They are much easier for users to discover since their pages
can be displayed in search results and listed in common search
engines such as Google or Bing.
~ Visitors to your regular website can be automatically sent to
the mobile web app when they are on a handheld mobile device
(using device detection).
~ Just like a standard website, mobile websites / web app can
be developed as database-driven web applications that act very
much like native apps.that are HOPE EO
ener dove lper AS
oe sony have Himited scope as FHF 38 aecessing
‘> Mobile WER APPT ues is concerned (devicespecifc hand
ipoite device's fei
ures, Senso, 6)
any variations bet
daclop sable webapp tat
They are not listed in ‘App Stores’. So if someone
foro
hough such means.
© Since there is no regularsed quality
pps, users may not always be guaranteed safety and security
of the app.
4 Web apps are unavailable when offline, even as a basic version
So, which is berer-a native app ora web app? It depends on your
«nd goals. If your goal i to establish a broad mobile presence, then you
sto
10 fora mobile web app.
If your goal isto provide an application that needs to work more
lite «computer program than a website, rich with interaction, a native
‘mobile app would be the best choice
Joven web browsers. and
ces it challenging to
rand phones that it makes it
rer runs onal devioes WihOUt any
looking
‘unable to discover it
tr app inthe app store, they will be unabl
control system for Web,
Inirosuction ty Mobite Applications us
‘Considering a graduated approach from mobile web app to native
app may make sense to many developers wanting to test the waters,
is may limit the scope of what's intending to be built.
4.3. MOBILE OPERATING SYSTEMS AND
APPLICATION PLATFORMS.
Mobile devices are evolving into increasingly sophisticated
and general purpose computers and this has led to the development
of a variety of platforms and operating systems in the mobile space.
‘Today the operating system lying inside your mobile device is equally
important a the device manufacturer (OEM). The various features,
GUI, processing speed and most importantly the applications available
{or your device will depend on the underlying OS.
‘The jargons like Mobile operating system and Mobile application
platforms give rise to doubts and I have tried in this article to address
any such doubts.
Mobile device manufacturers bring devices based on a variety
of platforms and OS's to cater to various user segments giving rise
to a number of Mobile OS and Application platforins. A Mobile OS
manages the hardware and software resources of a mobile device
similar to a computer OS. Some OS platforms cover the entire range
of the software stack while others may only include the lower levels
(ypically the kernel and middleware layers) and rely on additional
software platforms to provide a user interface framework,
Application development platforms, such as Brew, Symbian UIQ,
Android, LIMO, ALP, Qtopia or WIPI provide programming resources
for native and Java applications. Today's phones are expected to.run
1 growing range of software such as intemet browsers, navigation
packages, games and music/video players. Application platforms are
supposed to provide a ground for them, Application plattorms areoftware running
mm ah a set oF application
a or ay sss MT application
rin = al
; tabi market, « mobile devslone i
so mane he aT ing syste pa forms Dut thi
a develop fr multiple operating a
ed 4 time-consuming «sk @
‘ie sige one
sua
: and files.
gamers an
‘omimon! OS operations
Lunoate oo. PD
“is
tion Platform
sin t,t Ai
onset)
j/_-——
Tropetry mala AP
"et OS API 6®@ Zid ua APL se mt
Duss person
Media Acceleration
GPUDSPICPUS
‘Kernel Operating System
ce Windows CF Renan 5, bit, NIE)
Fig: 1.1
‘There is variety of both, Mobile OS and the Mobile application
platforms in mobile space with a few names enjoying most of
the market share. Here is a of major mobile operating, systems and
Application platforms. Examples of Mobile operating system with
complete software stack are Windows Mobile and Android,
introduction to Mobile Applications 17.
7.4 MOBILE (KERNEL) OPERATING SYSTEMS
‘Some Major Mobile Operating Systems (OS) used in smart phones
4.4.1 Symbian OS from the Symbian Foundation
‘symbian has the largest share in most markets worldwide, but
tags behind other companies in the relatively small but highly visible
North American market. It has been used by many major handset
manufacturers, incuding BenQ, Fujitsu, LG, Mitsubishi, Motorola,
Nokia, Samsuog, Sharp, and Sony Eriesson, Prior fo 2009 Symbian
fupported multiple user interfaces ie. UIQ from UIQ Technologies,
$60 ftom Nokia, and MOAP from NTT DOCOMO. As part of the
formation of the Symbian platform in 2009 these three Uls were
merged ino a single platform which is now fully open source. It has
received some adverse press attention due to virus threats (namely
“Trojan horses).
Symbian has a microkemel architecture, which means that the
minimum necessary is within the kernel to maximize robustness,
availability and responsiveness. It consists of kernel and middleware
components of the software stack. The upper layers are supplied
by application platforms like $60, UIQ, and MOAPIt contains a
scheduler, memory management and device drivers, but other services,
like networking, telephony and file system support are placed in the
(8 Services Layer or the Base Services Layer. The inclusion of device
drivers means the kernel is not a true microkemel
1.4.2 RIM Blackberry OS
Blackberry OS is the proprietary software platform, created by
Research In Motion, for their Black Bey phones. OS is focused
‘on easy operation and was originally designed for business. The
Blackberry operating system provides multitasking and supportsaay plato 48 pethaps best Known fOr its natyg
tag types. and the deep nes
tos infomation tobe passed between devigg
ently, In the Android wor
hat serve as the foundatony
wyelopers can also write ay,
nents in their website
th
{an important skill for Android developers.
XMLi
3, ANDROID SDK
SSD stands for Software Development Kit, which, though it may
tre up images of briefease full of spy tools, is actually just
ame for a set of pre-packaged code, The Android SDKs ar
fe that give developers access to device function
con
modules of Java cod
ike the camera and accelerometer, One key component of the Androt
SDK isa library ealled Grade. Let's say that you want £0 integra
Facebook with your app. You would download a code library (@
SDK) fom Facebook, and then tell Gradle that you’re using it, so tht
“shen your eppicaion compiles, your code stays well organized, Nex
Android developers will spend much oftheir time discovering how tt
‘arious SDKs for Android canbe pieced together indifferent ways
put together an application. While this will take time, each Andie
‘SDK comes with many examples that ean be found in the offic
ocumentation, making it easy to understand what each package des
{nd how to plug it into your app.
the application is alteag ¢
ntroduetion to Mobile Applications 123
[ANDROID STUDIO
tthe integrated development environment (IDE) of choice for
“Andeoid developers is called Android Studio, Android Studio is built
‘on top of the well-tespected Intell IDE, and it comes with great out-
foftthe-box support For many of the most common Android SDKs,
‘Android Studioalso features many ofthe capabilities developers expect
of a full-featured IDE. Code completion helps make auto-complete
suggestions as you type. Code debuegers let you step through your
‘code to identify the souree of errors. There are even more advanced
ols like memory and CPU monitors, helping developers make sure
their code will maintain high performance on a mobile device. Android
isa must have for the Android developer.
5. APIS
‘Asan Android developer, you'll likely want to interact with many
other services. For example, you may want to allow your users to
‘access a calendar from a third party service, or check the stock market
Many companies offer APIs, and will tll you exactly how to query
them for data in a consistent, secure way. While you're free to interact
with any existing API, Google also makes it very easy to connect to
their own APIs from your Android app. For example, you ean easily
use Google APIs to monitor the location of your users, let them search
for local places, and reference a map from within your application
‘You'll want o get comfortable exploring the nuances of different APIs,
and recognize that no two APIs are exactly alike.
6. DATABASES
If your app handles large amounts of data, most of it probably
won't live on your device at any given time. Instead, your app will
likely interact with a database living outside of your phone. Cloud
services like Firebase or Parse provide simple APIs to store data inication Developmen
mobile A
yICE?
«the Android operating
vt intended For Odile devi
pications and idea
pane abet PC, e-b00K reader
pROID DE)
advice that runs ©
ray of S0tt
anand i
ana 82
i oper
spite device that reap
a system
spa oes
anaadoid
ceareet™
‘peas
yy be asa
i ies an OS.
te Open Handset Alliance, WHC is
droid deviee manufacture,
ricsson and Motorola, *
developed b
ine of the well-known Al
‘rc. Samsung, LG, Sony
andrsid is
ty Google. Som
inslode Acct
smartphones, tablets any
‘a limited number of otk
the Binatone iHom,
popular Android devices include
rs. The Android OS is also built ino
i portable musi players,
devices, such as netbooks,
‘Phone and droid handheld game consoles.
Android device developers and programmers can find informatie,
athe Android website, which offers an Android software developmet
sit vithina short pesod the Android platform Became so popular tha
sed Windows Mobile and Symbian for anumber of application
‘Varous mobile device manufacturers embraced the Android platfon,
due to its overwhelming popularity, The reasons behind this succes
2s follows:
4 Cutting-edge technology offered by Google.
Extremely user friendly platform
+ Can be used in smartphones aswell as tablets.
Any user ean do medication to the platform as the Ando
SDK is open to users
‘% Availability of huge volume of applications.
ITES ANDROID DEVELOPMENT
Is you Need to be an Android
‘Android applications requires a deep knowledge of
puilding
immning and design. When approaching a new technology for the
it often helps to break it down into pieces. If you're a web
progr
first times
developer already.
spat development will be analogous fo things you already know
Mmough building apps for mobile devices often requires mastery
Gea number of more muineed concepts. Mobile devices have smaller
sereens, simpler processors, and ~ in the ease of Android ~ many
Jfiferent manufacturers, meaning that developers need to keép code
flexible and account fora variety of user scenarios
‘many of the concepts and technologies involved in
‘50 what does it take to become an Android developer? We asked
‘some of the brightest developers in our community here's what you
need to know.
1, JAVA
Java is the language that underpins all Android development. For
those who have gained most oftheir eoding experience in languages
like JavaScript and Ruby, there can bea learning curve when picking up
Java forthe frst time. Java, like JavaScript and Ruby, is object-oriented,
but it is also stricter about the way it handles datatypes. Developers
have tobe much more thoughtful with their code, defining the types of
data theie applications plan to work with, and more carefully allocating
searce memory resources. “You can’t afford to have ambiguity in a
‘mobile environment, and Java makes sure that there's no confusion
about what each component of your application is trying to do,” says
James Traver, a seasoned Android developer who now teaches the Web
Development Immersive at GA. “You end up writing less code, but
your code is more elegant and precise.”ante poication Devetopren
nt way 1 eo tf eng,
up langsaee, Sh3Hng may
: ognize the an
Fans 2 rr ~ you may FECES amg
re i IN ge he SSP iy
ths inormatin Co be passed eT Ween dvieg
etn eon god consistently. I the Android wor,
ing ay tha on Beate ayouts tha serve a the foundatong
re XML to ereate I
+ anda pplication. Developers ca as0 Fit ey
vc fayout elements once the application iS alreag
3 developers use JavaScript to modi,
the basics g
developers
uration
cose that sod
soit sae way tat WED
as site at runtime, but masterin
‘element in their wet
ws roid developers.
{XML isan important skil for And
3, ANDROID SDK
SDK stands for Software Development Kt, which, though itm
conjure up images of a briefcase fll of spy tools, is actually jus
fhney name for a set of pre-packaged code, The Android SDKs a
‘motuls of lava code tat give developers access to device function
lik the camera and accelerometer. One key component ofthe Andra
SDK is a library called Gradle. Let's say that you want to integra
Facebook with your app. You would download a code library (e
SDK) from Facebook, and then tell Gradle that you're using it, so hs
‘when your application compiles, your code stays well organized. New
Android developers wil spend much of ther time discovering how th
various SDKs for Android can be pieced together in different ways
put together an application. While this will take time, each Android
SDK comes with many examples that can be found in the offic
ocumentation, making it easy to understand what each package dos
‘and how to plug it into your app. {
nuroduction to Mobile Applications 123
3, ANDROID STUDIO
‘phe integrated development environment (IDE) of choice for
“android developers is called Android Studio, Android Stadio is built
‘atop ofthe wellstespected Intell IDE, and it comes with great out-
Gethe-box support for many of the most common Android SDKs.
“android Studio also features many ofthe capabilities developers expect
fa fal-eatured IDE, Code completion helps make auto-complete
‘suggestions as you type. Code debuggers let you step through your
ode to identify the source of errors. There are even more advanced
tools like memory and CPU monitors, helping developers make sure
their code will maintain high performance on a mobile device. Android
studio.is a must have for the Android developer.
5. APIS
‘Asan Android developer, you'll likely want to interact with many
‘other services. For example, you may want to allow your users to
‘access a calendar from a third party service, or check the stock market.
‘Many companies offer APIs, and will tell you exactly how to query
them for data in a consistent, secure way. While you're free to interact
with any existing API, Google also makes it very easy to connect to
their own APIs from your Android app. For example, you can easily
use Google APIs to monitor the location of your users let them search
for local places, and reference a map from within your application.
‘You'll want to get comfortable exploring the nuances of different APIs,
and recognize that no two APIs are exactly alike.
6. DATABASES
If your app handles large amounts of data, most of it probably
won't live on your device at any given time. Instead, your app will
likely interact with a database living outside of your phone. Cloud
services like Firebase or Parse provide simple APIs to store data in425
OL EE ee pe ay
a inc Tos plants tte Mei tan
lig ito YOU €DD, makin, New tes begin with the tutorials
‘Step 1 ~ Download Java Platform JDK) and instal it on your
ie elo and ake it
ares that YO
ve ihe user's device. This syncing
computer, Once completed, then proceed to the next step. Java is
renee fa storage a remote dala important i yoy
een bey reo tN WAY © oy, fmptant forthe finiosing of Android Si,
‘Roi’ built-in support for using SQL 7 . pe Sto. “
to handle data iy zee
However you choose t
fore and understand how database,
often provide Java lit
fr easy to cache some ofthe dats oF
want to fot users use
ata locally is through
interat witha SQLite database
‘your application, you'll eed 1 ex
query that data and se itn your app
‘work, and the ways (0
7. MATERIAL DESIGN
in conrast to competitors like Apple, Google has not historical
maintained a consistent design aesthetic cross thei products. In ret
sears, that has changed. Google has released @ set of forward-thinking
Jvc quidetne and standards called Material Design tht re being
rts. Those standards include tps fo
leo se he sean nd we Hy
aa ows Yoav prbsby sen Material Desi in il xX windows fom the nti nae
° at ney Gangrene eset evniaas ae
iyo
application on mobil
“Android developers use these guidelines asa foundation for their ow
user interfaces. The documentation online provides a great foundations
: Android Studio
understanding of Material Design principles.
4.9 HOW TO INSTALL ANDROID STUDIO ON
WINDOWS
‘The installation process can take a while, but itis very simple a
straight forward. All you need (0 do is carefully read the on-sére=
instructions and follow our guide as shown with screenshots. TH
‘Step 3 ~ Run the EXE setup file you just downloaded. You should
ccurent version of Android Studio is v2.3.3 as of writing this tutoral
‘These same instructions can be followed for installiag Android Stuit
ing Androi be greeted with a similar setup wizard screen as shown below. Click
on Windows 7, Windows 8 and Windows 10. Next to begin!Introduction to Mobite Applications
‘Step 6 ~ This is where you select the installation location for
‘Step 4 — Keep the default components selected for installation, Android Studio and Android SDK. You may select another location
Click Next. / drive that has the required space available. Click Next to continue,
SS ee eee
z a
‘Step 7 Yes, you would want to have to a Start menu folder. Just
click Install to continue,
Step § — We are sure you would not want to read through the ent
ense agreement. Click I Agree.Mobile Application Develop
28 Amtroduction to Mobite Applications
Step 10 Yep, this it, You
Step 10 Ye. thsi. You areal eta launch Android
the first time. Click Finishto proceed,
now. This may take a while
— Installation should begin
siep§
7 xcted and installed to your computer.
all the files to be extra
‘This was easy so far, right? Well, this was just the installation part
el of Android Studio, Next you need to configure your Android Studio
Saat and install a few basic tools that are needed.
vanoromgerens ees csarsteae eae Ifyou have any problems, comment below and we will get to you
SE TST 1s soon as possible,
4.40 IDE (INTEGRATED DEVELOPMENT
ENVIRONMENT)
completed, click Next.
“ Te [An IDE is a software development tool that is mainly used by
the developers to write and test the programs or software. These are
‘Step 9 Once the installation is
actually a migration form of primitive text editors to use of more full
function technologies that might help you in editing code more quickly
and efficiently. Generally the IDEs are complicated to leam, takes time
to master.
Why do we use them?
For a professional software engineer to build a large seale systems
he needs a technological support atthe point of typing the code. At thatnuraetion to Mobile Applications 131
“_Ineqrated stepwise execution,
icin :
pint IDE cones Ny erst © fecereterth
af in IDE can
anu dan & Reformat coding,
software 9 ot
tween @ code &
not is difference Bet “sintn
we? nes take you to a woe HEN cee tee
hy the IDES take ok
syping €0
while
se code com - anda dap dwn in as @ Traverse a package hierarchy searching for all the instances of |
hat sige Moreover during a specific sting
sthecoding very
in notepad or text-editor,
xy them which makes
ral 19 check error i
& Helps in generating the UML diagram,
4.10.4 Some of the best IDEs
0.1 Features of IDE
7 sting by easy navigation through €04eS and Ecipse- particularly for Java,
pT supports for coding by €83
4 Visual Studio- for programming languages like C, C++, CH.
iris very easier to west and dobug # code in am integrate
ment environment han the code editor.
Android Studio- particularly for Android Java.
© Oneofthe mos important usefl feature of an IDE is suppor Pycharm- Particularly for Python,
for refacrng. i.e It helps programmes in differentiating be Rujbynfing-Particulaely for ruby on als.
ames of class, variables, packages, ele.
4.11 XML-(EXTENSIBLE MARKUP LANGUAGE)
% It provides support for IDE independent, cross platfom,,
stsndardized by helping in compilation, testing, packaging and
XML stands for Extensible Markup Language. XML is a markup
sad gly adr, language much like HTML used to describe data, XML tags are not
predefined in XML. We must define our own Tags. Xmas itself is well
1.10.2 Properties of IDE readable both by human and machine. Also itis scalable and simple to
Pliage meee develop, In Android we use xml for designing our layouts because xml
es : is lightweight language soit doesn’t make our layout heavy.
% Project definition facilites,
Integrated compilation,sroduction to Mobile Applications 133
ws
‘ndroid:orientation="vertical” android:layout_width="match_
parent”
ferent a sh
citer wits n child element a8 show
‘ViewGroup can
sn he igo given BIO:
“View Group (Relative Layou)
i View aie) |
View (Edit Text)
Fig: 1.2
ViewGroup (Linear Layout) contains on
and two View(Button and TextView)
itText ) are nested inside Relat
tis important to note that one | Jayout can be nested
Here in above Diagram
‘ViewGroup (ie, Relative Layout)
Further two more View (ie. 2 Bai
LayoutViewGroup.
in another layout.
“The below code snippet will explain the above image in better way
Paste it in actvity_main.xml:
">
<2xmnl version="1,0" encoding="utf
Button
android:id="@+id/butont”
androidlayout_width="wrap_content”
androidelayout_height="wrap_content™
android:text="Button"?>
Comite ratte e
+ Diew Layouts
Teampletindcdineayeisinnie EAM
El erampleabhiandicidineatayoutindescrcig pO Natal
Paes Stineaajout ei
El drapable, [E]Tabletayout
Ente Taleo
tity, minamt Giatayout
ae seh ‘FU Reativelayout
wget
7 Pin Tein
wo tageTet
‘BD Medium Text_obite Application Devel introduction to Mobile Applications 137
136 ——t code
Basic Ley van te MED NEE igo
se show activ
Jow
ae lx second TextView >
_ee- ReltiveLayoutin wi —
> incangide"npiichemssandoidcy andoiide"@ ident TexVew"
android:padding="10dp”
tools:contex
andridlayoutheigh"Wwrap_content
1.12.2 Manifest xml File(Mainfest.xml)
‘android: layout_centerHorizontal="true
eee ‘This xml is used to define all the components of our application.
It includes the names of our application packages, our Activities,
receivers, services and the permissions that our application needs For
android:text="First Text View" Example — Suppose we need to use intemetin our app then we need to
define temet permission inthis file
android:padding="10dp"
android:textColor="@color/white”Developmen,
ss roid StU
tion in A
ieee manifests OIF
cated inside PP
projet Files
nisl
insidescrolh,
ea eamleabhiandoidinestayout
i > ample abiandaasineatoyounsides ro
oy Cares
oidManifest.xml
ing Internet Permission in Ande jidMani
pw we stow te Androidanistxml fle and define
Bel
Internet Permission in that fie
an vesion="10" encoding="w-8"2>
manifest xmlnsandroid="htp:(schemas.android.convapkces
android”
package~"example abhiandroid. MyApplication”>
application
android:allowBackup="true"
———
npoction 10 Mobite Applications 139
naroid-icon="@mipmapfic launcher”
android:label="@string/app_name™
android:theme="@style/AppTheme”>
1--add your Activities, Reveivers, Services Names Here ~>
activity
android:name=” MainActvity”
android:label="@string/app_name">
action android:name="androi
<My Apion 1808
ting amotio ings >Setng n>
string name="login">User Login
lefine your strings here ~>
“
1.12.4 Styles xml File(styles.xml)
This xml is used to define different styles and looks for the UIs
_atbite Application Devetopney
Inicoduction to Mobile Applications a
Tocation in Android Studio
g [terekanis| o 8
Ev Soe
+ Comantese
eee
7o
> ES eampleabhiondidineniys
> ES eamplesbhiandiidtinenine
y Gre
Deeaabie
> Bayo
> Eimens
> Eamigmap
¥ Byales
‘Beeclorst
» Ehdimensaml 2)
Beavingsamt
a
i
3
Scaptues
Below we show the style.xml file.
resources
|- Base application theme. —>