Escolar Documentos
Profissional Documentos
Cultura Documentos
DEVELOPMENT – UNIT -1
S.PRABHAKARAN
DEPARTMENT OF CSE
SRM IST – KTR CAMPUS
1
Introduction:
Introduction to mobile application development
Trends
Introduction to various platforms
Introduction to smart phones
2
Introduction to MAD
Native Applications:
Native Apps are developed specifically for one platform,
and can take full advantage of all the device features.
They are also built using the specific Integrated
Development Environment (IDE) for the given operating
systems.
Android Studio for Android Apps and XCode for iOS Apps.
IOS apps are written in Objective-C and Swift
Android apps are written in Java or Kotlin.
Windows and Blackberry apps are written in C++.
3
Introduction to MAD
4
Introduction to MAD
Pros
Very fast and responsive because they are built for that specific
platform.
Best performance.
More interactive, intuitive and run much smoother in terms of user
input and output.
Cons
More expensive to develop compared to cross-platform and web
applications.
Require more time to develop as one application has to be written in
different languages for different platforms.
Higher cost of maintenance and pushing out updates, due to multiple
source code bases.
5
Introduction to MAD
Hybrid Applications:
These are applications developed to be used across multiple
platforms i.e can be deployed on both iOS and Android
platforms.
Technologies like HTML, CSS, and JavaScript.
Some popular frameworks for building Hybrid applications
include;
Ionic Framework
PhoneGap
Sencha Touch
Apache Cordova
6
Trends
Accelerated Mobile Pages (AMP)
AMP is a project undertaken by Google in association
with Twitter and includes several other large search,
social and web publishing platforms around the world.
AMP Project is an open-source website publishing
technology designed to improve the performance of web
content and advertisements.
As an alternative, the webpage can be displayed
simultaneously while it is loading instead of making the
user wait for the whole page to load - it is called lazy
loading.
7
Trends
AR & VR Apps
With is technology, one could feel like they are inside the
imaginary world.
Cloud-driven Mobile Apps
A cloud-driven or cloud application is simply an mobile
application that runs on the server instead of your device.
A cloud app will serve same features and characteristics as the
pure desktop or device app, but functions in the cloud storage.
Enterprise Apps & Micro-apps
In the world of mobile, a micro app is a consumer-oriented
application delivering highly targeted functionality (e.g. a
weather forecast app).
8
Trends
Security In Apps
Your phone probably has sensitive information on it, so
it may be a good idea to install some security software.
Avast Mobile Security
AVG
Sophos Mobile Security
Avira Antivirus
9
Trends
IoT Apps
10
VARIOUS PLATFORMS
11
VARIOUS PLATFORMS
12
Introduction to Smart Phones
Phones used to be all about making calls, but now your
mobile can do so much more.
Touchscreen smartphones allows you to access the
internet, use social media, get live news updates, play music
and video, and much more.
They almost universally use touchscreens for control,
however, which can be a challenge for people new to the
technology.
13
Introduction to Smart Phones
14
Android platform:
Android platform features and architecture
Versions
Comparison added features in each versions
ART(Android Runtime)
ADB(Android Debug Bridge).
15
Android Platform
16
Android Platform
17
Android Features
Messaging
SMS and MMS
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.
18
Android Features
Multitasking
User can jump from one task to another and same time
various application can run simultaneously.
Multiple language support
Supports single direction and bi-directional text.
Connectivity
GSM/EDGE, IDEN, CDMA, EV-DO, UMTS, Bluetooth, Wi-
Fi, LTE, NFC and WiMAX.
19
Android Features
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.
External storage
SQLite, a lightweight relational database, is used for data
storage purposes.
Hardware support
Bluetooth
Tethering
Streaming media support
20
Android Features
Auto Correction and Dictionary
Voice-based features
Screen capture
TV recording
Video calling
Accessibility
21
Android Version and Comparison
22
Android Version and Comparison
23
Android Version and Comparison
24
Android Version and Comparison
25
Android Version and Comparison
26
Android Version and Comparison
27
ANDROID - ARCHITECTURE
28
The Linux Kernel
The foundation of the Android platform is the Linux
kernel.
This provides a level of abstraction between the device
hardware and it contains all the essential hardware
drivers like camera, keypad, display, networking etc.
Bridge between OS and Hardware
Handles…
memory management, file management
task scheduling, process management, managing
hardware devices.
29
Hardware Abstraction Layer (HAL)
The HAL provides is a logical division of code that serves as
an abstraction layer between a computer's physical
hardware and its software.
It provides a device driver interface allowing a program to
communicate with the hardware.
When a framework API makes a call to access device
hardware, the Android system loads the library module for
that hardware component.
30
Libraries
Libraries including Open-source Web browser engine
WebKit, well known library libc, SQLite database which is
a useful repository for storage and sharing of application
data, libraries to play and record audio and video, SSL
libraries responsible for Internet security etc..
31
ANDROID LIBRARIES
android.app − Provides access to the application model
and is the cornerstone of all Android applications.
android.content − Facilitates content access, publishing
and messaging between applications and application
components.
android.database − Used to access data published by
content providers and includes SQLite database
management classes.
android.opengl − Graphics library - A Java interface to the
OpenGL ES 3D graphics rendering API.
32
ANDROID LIBRARIES
android.os − Provides applications with access to standard
operating system services including messages, system
services and inter-process communication.
android.text − Used to render and manipulate text on a
device display.
android.view − The fundamental building blocks of
application user interfaces.
android.widget − A rich collection of pre-built user
interface components such as buttons, labels, list views,
layout managers, radio buttons etc.
33
ANDROID LIBRARIES
android.webkit − A set of classes intended to allow web-
browsing capabilities to be built into applications.
Android Runtime
This section provides a key component called Dalvik Virtual
Machine which is a kind of Java Virtual Machine specially
designed and optimized for Android.
The Dalvik VM makes use of Linux core features like memory
management and multi-threading, which is native in the Java
language.
ART performs the translation of the
application's bytecode into native instructions that are later
executed by the device's runtime environment.
34
ANDROID RUNTIME
Application Framework
The Application Framework layer provides many higher-
level services to applications in the form of Java classes.
Activity Manager − Controls all aspects of the
application lifecycle and activity stack.
Content Providers − Allows applications to publish and
share data with other applications.
Resource Manager − Provides access to non-code
embedded resources such as strings, color settings and
user interface layouts.
35
ANDROID RUNTIME &
APPLICATIONS
Notifications Manager − Allows applications to display
alerts and notifications to the user.
View System − An extensible set of views used to create
application user interfaces.
Applications
You will find all the Android application at the top layer.
You will write your application to be installed on this
layer only. Examples of such applications are Contacts
Books, Browser, Games etc.
36
Android Runtime (ART)
Android Runtime (ART) is an application runtime
environment used by the Android operating system.
Replacing Dalvik, the process virtual machine originally
used by Android, ART performs the translation of the
application’s bytecode into native instructions that are later
executed by the device’s runtime environment.(ART
introduced in Android L).
ART is software layer between applications and operating
system.
It provide mechanism for executing java language.
37
Android Runtime (ART)
ART perform two major things to achieve this
Runs Android framework and Applications using hybrid
model of Interpreter, JIT and profile based Ahead of time
compilation(AOT).
Memory Management using Memory allocator and
Concurrent compacting Garbage collector.
38
Android Debug Bridge(ADB)
Android Debug Bridge (adb) is a versatile command-line
tool that lets you communicate with a device.
The ADB command facilitates a variety of device actions,
such as installing and debugging apps, and it provides
access to a Unix shell that you can use to run a variety of
commands on a device.
It is a client-server program that includes three
components:
A client, which sends commands. The client runs on your
development machine. You can invoke a client from a
command-line terminal by issuing an adb command.
39
Android Debug Bridge(ADB)
A daemon (adbd), which runs commands on a device.
The daemon runs as a background process on each
device.
A server, which manages communication between the
client and the daemon. The server runs as a background
process on your development machine.
40
Development environment/IDE:
Android studio and its working environment
Gradle build system
Emulator setup
41
Android Studio Features
Android Studio offers even more features that enhance your
productivity when building Android apps, such as:
A flexible Gradle-based build system
A fast and feature-rich emulator
A unified environment where you can develop for all
Android devices
Instant Run to push changes to your running app without
building a new APK
Code templates and GitHub integration to help you build
common app features and import sample code
Extensive testing tools and frameworks.
42
Android Studio Features
Lint tools to catch performance, usability, version
compatibility, and other problems
C++ and NDK support
Built-in support for Google Cloud Platform, making it
easy to integrate Google Cloud Messaging and App
Engine
43
Development environment/IDE
You can start your Android application development on
either of the following operating systems −
Microsoft Windows XP or later version.
Mac OS X 10.5.8 or later version with Intel chip.
Linux including GNU C Library 2.7 or later.
Following is the list of software's you will need before you
start your Android application programming.
Java JDK5 or later version
Android Studio
44
Development environment/IDE
Starting a new project
Launching Android Studio and then selecting New Project,
or you can choose File > New > New Project at any time from
the IDE itself.
45
Development environment/IDE
46
Development environment/IDE
47
Development environment/IDE
48
Development environment/IDE
1. Toolbar lets you carry out a wide range of actions, including
running your app and launching Android tools.
2. Navigation bar helps you navigate through your project and
open files for editing. It provides a more compact view of the
structure visible in the Project window.
3. Editor window is where you create and modify code.
Depending on the current file type, the editor can change. For
example, when viewing a layout file, the editor displays the
Layout Editor.
4. Tool window bar runs around the outside of the IDE window
and contains the buttons that allow you to expand or collapse
individual tool windows.
49
Development environment/IDE
5. Tool windows give you access to specific tasks like project
management, search, version control, and more. You can
expand them and collapse them.
6. Status bar displays the status of your project and the IDE
itself, as well as any warnings or messages.
50
Gradle Build System
Android Studio uses Gradle as the foundation of the build
system, with more Android-specific capabilities provided by
the Android plugin for Gradle.
This build system runs as an integrated tool from the Android
Studio menu, and independently from the command line.
You can use the features of the build system to do the
following:
Customize, configure, and extend the build process.
Create multiple APKs for your app, with different features
using the same project and modules.
Reuse code and resources across sourcesets.
51
Emulator Setup
The emulator lets you prototype, develop and test Android
applications without using a physical device.
Creating AVD
If you want to emulate a real device, first create an AVD
with the same device configurations as real device, then
launch this AVD from AVD manager.
Changing Orientation
Usually by default when you launch the emulator, its
orientation is vertical, but you can change it orientation
by pressing Ctrl+F11 key from keyboard.
52
Emulator Commands
Home - Shifts to main screen
F2 - Toggles context sensitive menu
F3 - Bring out call log
F4 - End call
F5 - Search
F6 - Toggle trackball mode
F7 - Power button
F8 - Toggle data network
Ctrl+F5 - Ring Volume up
Ctrl+F6 - Ring Volume down
53
Application anatomy:
Application framework basics: resources layout, values,
asset XML representation and generated R.Javafile,
Android manifest file.
Creating a simple application.
54
Android - UI Layouts
55
Android - UI Layouts
56
Android Layout Types
Linear Layout is a view group that aligns all children in a
single direction, vertically or horizontally.
Relative Layout is a view group that displays child views in
relative positions.
Table Layout is a view that groups views into rows and
columns.
Absolute Layout enables you to specify the exact location of
its children.
Frame Layout is a placeholder on screen that you can use to
display a single view.
57
Android Layout Types
List View is a view group that displays a list of scrollable
items.
Grid View is a View Group that displays items in a two-
dimensional, scrollable grid.
58
Layout Attributes
android:id - This is the ID which uniquely identifies the view.
android:layout_width - This is the width of the layout.
android:layout_height - This is the height of the layout
android:layout_marginTop - This is the extra space on the top
side of the layout.
android:layout_marginBottom - This is the extra space on the
bottom side of the layout.
android:layout_marginLeft - This is the extra space on the left
side of the layout.
android:layout_marginRight - This is the extra space on the
right side of the layout.
59
Layout Attributes
android:layout_gravity - This specifies how child Views are
positioned.
android:layout_weight - This specifies how much of the
extra space in the layout should be allocated to the View.
android:layout_x - This specifies the x-coordinate of the
layout.
android:layout_y - This specifies the y-coordinate of the
layout.
android:layout_width - This is the width of the layout.
android:layout_width - This is the width of the layout.
60
Layout Attributes
android:paddingLeft - This is the left padding filled for the
layout.
android:paddingRight - This is the right padding filled for
the layout.
android:paddingTop - This is the top padding filled for the
layout.
android:paddingBottom - This is the bottom padding filled
for the layout.
61
Generated R.Javafile
R.java is neat. R.java is elegant. Due to its subversiveness (in
a good way) its makings are implicit. It is fun to learn about
Android.R.
At a mile high level, every application has resouces.
Familiar example of resources are strings, colors, and
bitmaps. Instead of hard coding strings in an application
one will use an id for a string.
Let's start with strings and see how they are used.
62
Generated R.Javafile
63
XML representation
XML stands for Extensible Mark-up Language.
XML is a very popular format and commonly used for
sharing data on the internet.
This chapter explains how to parse the XML file and extract
necessary information from it.
Android provides three types of XML parsers which
are DOM,SAX and XMLPullParser.
Among all of them android recommend XMLPullParser
because it is efficient and easy to use.
So we are going to use XMLPullParser for parsing XML.
64
XML representation
The first step is to identify the fields in the XML data in
which you are interested in.
For example. In the XML given below we interested in
getting temperature only.
65
XML Elements
Prolog - An XML file starts with a prolog. The first line that
contains the information about a file is prolog
Events - An XML file has many events. Event could be like
this. Document starts , Document ends, Tag start , Tag end
and Text e.t.
Text - Apart from tags and events, and xml file also contains
simple text. Such as GB is a text in the country tag.
Attributes - Attributes are the additional properties of a tag
such as value e.t.c
66
ANDROID MANIFEST FILE
Every app project must have an AndroidManifest.xml
The manifest file describes essential information about your app
such as activities, services, broadcast receivers, content providers
etc.
It performs some other tasks also:
It is responsible to protect the application to access any
protected parts by providing the permissions.
It also declares the android api that the application is going to
use.
It lists the instrumentation classes. The instrumentation classes
provides profiling and other information. These information are
removed just before the application is published etc.
67
ANDROID MANIFEST FILE
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.javatpoint.hello"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
68
ANDROID MANIFEST FILE
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
69