04 development and runtime platforms: overview, j2me, ios...
TRANSCRIPT
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 11
Mobile Systems M
Alma Mater Studiorum – University of Bologna
CdS Laurea Magistrale (MSc) in
Computer Science Engineering
Mobile Systems M course (8 ECTS)II Term – Academic Year 2018/2019
04 – Development and Runtime Platforms:
Overview, J2ME, iOS, and Android
Paolo Bellavista
http://lia.disi.unibo.it/Courses/sm1819-info/
http://lia.disi.unibo.it/Staff/PaoloBellavista/
Development/Runtime Platforms – Mobile Systems M 2
Overview on
Development/Runtime Platforms
Many solutions have been proposed in the literature for
development/runtime support of mobile systems
middleware and applications. Why?
❑ Heterogeneity and fragmentation
❑ Market-driven choice
❑ Very heterogeneous and differentiated characteristics
of available devices, “platforms”, and app requirements
Plethora of solutions: Symbian, Palm, RIM, Maemo/Meego, iOS,
Android, Java Mobile Edition (J2ME), .NET Compact Framework (CF),
Python, Lazarus, Brew, Flash Lite, Web runtime environment (micro-
browser, HTML5, XHTML/CSS, JavaScript, Mobile Ajax, …), …
Let’s try to put in order…
Which involved layers?
Development/Runtime Platforms – Mobile Systems M 3
❑ Operating system layer (e.g., is Android an operating system?)
❑ Runtime execution support layer (frameworks,
containers, virtual machines, …)
❑ Development support layer - SDK (libraries, support
components, containers, …)
Again, layers with NO clear borders and NOT easily disjoint…
❑ Mainly at OS layer: Symbian, Palm, RIM (BlackBerry),
Maemo/Meego, iOS, Linux?, …
❑ Mainly at runtime execution support layer: Kernel-based Virtual
Machine (KVM) or Dalvik Virtual Machine for Java, Common Language
Runtime (CLR) for .NET, Flash Lite, Web runtime environment
Overview on
Development/Runtime Platforms
Development/Runtime Platforms – Mobile Systems M 4
❑ Mainly at development support layer: J2ME world, .NET CF
world, ActionScript for Flash Lite, Android world, Web runtime
environment
Two primary approach categories:
❑ Based on native applications
❑ Based on Web integration (in particular, see standardization
efforts associated with HTML5)
Let’s start with the first approach, by choosing to have a rapid
overview on 4 main families of solutions: J2ME, .NET CF,
Flash Lite, and Android
Overview on
Development/Runtime Platforms
Development/Runtime Platforms – Mobile Systems M 5
Overview on J2ME, .NET CF,
Flash Lite, and Android
Development/Runtime Platforms – Mobile Systems M 6
J2ME in a Single Slide
❑ Java edition for resource-limited devices (smart phones, set-
top boxes) – http://www.oracle.com/technetwork/java/
embedded/javame/index.html
❑ Bytecode is run over Kernel-based Virtual Machines
(KVM), full OS independency
❑ Configuration concept: minimum feature set for VM + support
libraries for a horizontal family of devices
➢ Connected Limited Device Configuration (CLDC)
❑ Profile concept: specialized libraries for the characteristics of a
given type/class of devices
➢ Mobile Information Device Profile (MIDP), on top of CLDC
❑ Java apps over CLDC/MIDP are called MIDlet
Do you already know what Java Community Process (JCP) and Java
Specification Request (JSR) are?
Development/Runtime Platforms – Mobile Systems M 7
.NET CF in a Single Slide
❑ Subset of .NET platform (around 30% of classes and features) for
MS Windows Mobile devices
❑ Exploitation of Common Language Runtime (CLR); in
principle, support for different OSs and different programming
languages (actually only WinMobile, C#, and VB.NET)
❑ Idea of smooth transition from desktop app development to
mobile app development, anyway pushed by a big vendor with a
large community of developers
❑ Cost associated with intermediate code execution (Common
Intermediate Language – CIL)
❑ Relatively high cost in terms of memory footprint
❑ It has NO “fragmentation” problems, differently from J2ME
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 8
Adobe Flash Lite in a Single Slide
❑ Proprietary technology that was popular for the
development of multimedia contents and games
❑ Basically, support for vectorial graphics and
animations; add-ons of application and presentation logics
via ad-hoc programming language, i.e., ActionScript, which runs over a dedicated runtime support
❑ Smooth transition for expert Flash developers
❑ Incomplete solution for stand-alone full-fledged apps; NO
ambition of general purpose solution
❑ Strong integration with low-level capabilities of devices, therefore with good efficiency
❑ Limited performance due to cost of vectorial graphics management
❑ See similar approach in the Java world with JavaFX Mobile –
https://www.java.net/community/javafx
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 9
Android in a Single Slide
❑ Launched by Google in 2007 as an Apache free-software platform, based on Linux
❑ Applications were developed in Java and compiled intoDalvik Executable format (DEX – custom bytecode, e.g., more concise than usual .class)
❑ Quite large subset of J2SE facilities + rich library of support features (Android SDK) available for the community of developers❑ Touch screen management, local sensors (accelerometers,
gyroscopes, GPS, …), 3D graphics, advanced support for location-based services, …
❑ Also here possible? fragmentation issues due to different OS versions and to usage of different extensions of the support stack(given the potential openness of the adopted approach…)
Development/Runtime Platforms – Mobile Systems M 10
A Comparison with a Toy Application
(Gavalas et al, IEEE Software, 2011)
Development/Runtime Platforms – Mobile Systems M 11
A First Comparison
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 12
A First Comparison
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 13
A First Comparison
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 14
A First Comparison
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 15
A First Comparison
Development/Runtime Platforms – Mobile Systems M 16
By delving into finer technical details:
Java 2 Micro Edition
In general terms, different editions of Java “distributions”
Central role of
the KVM +
CLDC +
MIDP stack
Development/Runtime Platforms – Mobile Systems M 17
JSR 248:
Mobile Service Architecture (MSA)
17
Actually, more complex
and articulated
situation
Important
fragmentation
issues
MSA, in two
versions:
full (17/14) or
subset (8/9)
Development/Runtime Platforms – Mobile Systems M 18
J2ME: Configurations and Profiles
❑ A configuration defines a minimal platform for a
horizontal group of devices
➢ Similar requirements on memory and computing power
➢ It defines Java language and virtual machine characteristics
that have to be available on the targeted group of devices
➢ “A Configuration is a specification that defines a minimum Java Platform
functionality for a family of devices. It defines the minimum number of Java
libraries, VM capabilities, Security specification, and a Generic Connection
Framework”
❑ Profile as a set of additional APIs that extend a
configuration with capabilities that are useful for a specific
group of devices➢ “A Profile is a collection of Java APIs that supplement a Configuration to
provide capabilities for a specific device group or market type”
Development/Runtime Platforms – Mobile Systems M 19
J2ME: Defined Configurations
❑ Connected Device Configuration (CDC)
➢ Typically for devices with higher resources if compared with low-end phone devices (no more valid nowadays)
➢ For example, set-top boxes, initially some kinds of PDAs, …
❑ Connected, Limited Device Configuration (CLDC)
➢ For devices with very limited onboard resources
Virtual machine for CLDC: Sun’s Kilo Virtual Machine (KVM)➢ Small memory footprint (60K)
➢ Overall minimum memory = 160K
➢ 16/32-bit processors
➢ Processor speed = at least in the range 8-32MHz
➢ Typical hardware of CLDC configuration
For CLDC the only STRONG requirement is available memory size:➢ At least non-volatile 128K for KVM and CLDC libraries
➢ At least volatile 32K for KVM runtime
Development/Runtime Platforms – Mobile Systems M 20
J2ME Profiles
Any profile defines requirements for a family of devices
associated with a specific vertical market
❑ It extends (with a upper overlay layer) a configuration. Always on
top of one defined configuration
❑ It defines a standardized Java platform for a device family/class
in order to achieve interoperability (effort towards the reduction of
fragmentation issues)
❑ It includes class libraries with finer granularity if compared with the
ones in a configuration
Available profiles:
❑ Mobile Information Device Profile (MIDP)
on top of CLDC. It includes additional features for GUIs, multimedia
and gaming support, end-to-end security, extended support to
network connectivity for mobile phones and entry-level PDAs
Development/Runtime Platforms – Mobile Systems M 21
Defined J2ME Profiles(continued…)
❑ …
❑ Foundation Profileon top of CDC. Set of basic Java APIs for resource-limited devices; crucial and central factor is lack of standard GUI support
❑ Personal Profile
on top of CDC. Together with Foundation Profile, Personal Profile implements the support for development of high-end PDA applications. Personal Profile includes complete set of AWT APIs, support for applets and Xlets
❑ Personal Basis Profile
on top of CDC. It provides developers with an environment for the support of applications with network connectivity and an elementary degree of grahics support for content presentation
Development/Runtime Platforms – Mobile Systems M 22
MIDP: Hardware Requirements
❑ Memory (in addition to the one requested by CLDC)
➢ 128K non-volatile for MIDP components
➢ 8K non-volatile for persistent application data
➢ 32K volatile for KVM
❑ Display
➢ Screen with at least 96x54 pixels
➢ Display depth (or color depth or bit per pixel) at least equal to 1-bit
➢ Form factor of pixels (aspect ratio) = 1:1
❑ Input peripherals (one or multiple)
➢ One-handed keypad
➢ Two-handed keypad
➢ Touch screen
❑ Networking
➢ Two-way
➢ Wireless
➢ Management of intermittent connectivity
➢ Limited bandwidth
Development/Runtime Platforms – Mobile Systems M 23
MIDP Architecture
Mobile Information Device (MID)
CLDC
MIDP
Native OS + System Software
MIDP
Applications
OEM-Specific
Applications
OEM-Specific
Classes
Device-Native
Applications
Original Equipment Manufacturer (OEM)
Development/Runtime Platforms – Mobile Systems M 24
Class Libraries
❑ CLDC
java.lang
java.io
java.util
javax.microedition.io
❑ MIDP
javax.microedition.lcdui
javax.microedition.midlet
javax.microedition.rms
Development/Runtime Platforms – Mobile Systems M 25
MIDP Application Model
❑ MIDP applications are called “MIDlets”❑ MIDlet model is, under many perspectives,
similar to the applet model in J2SE: component-container model and lifecycle management
❑ Also security support for applications that share resources/data (via MIDlet Suite)
❑ MIDlet lifecycle is described as state transitions, indicated as:➢ Start – resource acquisition and execution start➢ Pause – resource release and entrance in the
“wait” state➢ Destroy – resource release, thread destruction,
and ending of all activities
➢ Java Application Manager (JAM) for MIDlet lifecycle management
Pause
Active
Destroyed
sta
rtA
pp
de
str
oyA
pp
pa
us
eA
pp
de
str
oyA
pp
Development/Runtime Platforms – Mobile Systems M 26
Typical J2ME Support Stack
Mobile Information
Device Profile
KVM
CLDC = KVM + J2ME Core
API in this
example DSP chip(e.g., ARM)
J2ME core APIs
Your
MIDletYellow pages, train timetable and ticketing, games, …
UI, HTTP networking, ...
Thread support,
no floating point…
32-bit RISC, 256K ROM, 256K Flash, 64K RAM
KVM + CLDC + MIDP: applications are developed and run on top
of this standardized stack, independently from OS and hw
details
Development/Runtime Platforms – Mobile Systems M 27
CLDC/MIDP: some Detail about the Primary Packages
❑ Package➢ javax.microedition.io
➢ javax.microedition.lcdui (user interface for lcd displays)
➢ javax.microedition.midlet
➢ javax.microedition.rms (persistent storage)
❑ Widget support for user GUIs➢ Form, TextField, TextBox, DateField, List, Image, Gauge, Alert,
Canvas, Graphics, Display
➢ Two different types of APIs (lower and higher abstraction layers) for GUI management
▪ High level for widget, scrolling, ...
▪ Low level for graphics fine-grained GUI control
❑ Classes for event management – Command and CommandListener
❑ Most relevant: is obvious for all, isn’t it ☺?, which is the underlying threading model?
Development/Runtime Platforms – Mobile Systems M 28
Usual “Hello World”
as a MIDlet
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class HiMIDlet extends MIDlet {
private TextBox textbox;
public HiMIDlet() {
textbox = new TextBox ("", "Hello World!", 20, 0);
}
public void startApp() {
Display.getDisplay(this).setCurrent(textbox);
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
}
Development/Runtime Platforms – Mobile Systems M 29
MIDlet:
Simple GUI Managementimport javax.microedition.midlet.*;import javax.microedition.lcdui.*;
public class HelloWorld extends MIDlet implements CommandListener {
private Form mainscreen;private Form detailsscreen;private Display myDisplay;private Command exitCommand;private Command resetCommand;private Command detailsCommand;
public HelloWorld(){
myDisplay = Display.getDisplay(this);mainscreen = new Form("Hello World");detailsCommand = new Command("Details",Command.SCREEN, 1);resetCommand = new Command("Reset",Command.SCREEN,1);exitCommand = new Command("Exit", Command.EXIT, 1);
}
Development/Runtime Platforms – Mobile Systems M 30
StringItem strItem = new StringItem("Hello", " World");
mainscreen.addCommand(detailsCommand);
mainscreen.addCommand(resetCommand);
mainscreen.addCommand(exitCommand);
mainscreen.append(strItem);
mainscreen.setCommandListener(this);
public void startApp() {
myDisplay.setCurrent(mainscreen); }
protected void pauseApp() { }
protected void destroyApp(boolean unconditional) { }
MIDlet:
Simple GUI Management
Development/Runtime Platforms – Mobile Systems M 31
public void commandAction(Command c, Displayable s) {
if (c == exitCommand) {
destroyApp(false);
notifyDestroyed(); }
else if (c == detailsCommand) {
detailsscreen = new Form("Details");
detailsscreen.addCommand(resetCommand);
detailsscreen.setCommandListener(this);
myDisplay.setCurrent(detailsscreen); }
else if (c == resetCommand) {
myDisplay.setCurrent(mainscreen); }
}
}
MIDlet:
Simple GUI Management
Development/Runtime Platforms – Mobile Systems M 32
import java.io.*;
import javax.microedition.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class PrimitiveMIDlet extends MIDlet
implements CommandListener {
private Display mDisplay;
private Form mMainForm;
private Command mExitCommand, mConnectCommand;
public void startApp() {
mDisplay = Display.getDisplay(this);
if (mMainForm == null) {
mMainForm = new Form("PrimitiveMIDlet");
mMainForm.append(new StringItem("", "Select Connect to
make a network connection"));
mExitCommand = new Command("Exit", Command.EXIT, 0);
mConnectCommand = new Command("Connect",
Command.SCREEN, 0);
MIDlet:
a more Realistic Example
Development/Runtime Platforms – Mobile Systems M 33
mMainForm.addCommand(mExitCommand);
mMainForm.addCommand(mConnectCommand);
mMainForm.setCommandListener(this); }
mDisplay.setCurrent(mMainForm); }
public void commandAction(Command c, Displayable s) {
if (c == mExitCommand) notifyDestroyed();
else if (c == mConnectCommand) connect();
}
private void connect() {
String url = getAppProperty("NetworkThreading.URL");
try { //interroga server e riceve risposta
HttpConnection hc = (HttpConnection)Connector.open(url);
InputStream in = hc.openInputStream();
int contentLength = (int)hc.getLength();
if (contentLength == -1) contentLength = 255;
byte[] raw = new byte[contentLength];
int length = in.read(raw);
MIDlet:
a more Realistic Example
Development/Runtime Platforms – Mobile Systems M 34
in.close();
hc.close();
// Show the response to the user.
String s = new String(raw, 0, length);
Alert a = new Alert("Response", s, null, null);
a.setTimeout(Alert.FOREVER);
mDisplay.setCurrent(a, mMainForm); }
catch (IOException ioe) { Alert a = new Alert(
"Exception", ioe.toString(), null, null);
a.setTimeout(Alert.FOREVER);
mDisplay.setCurrent(a, mMainForm); }
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
}
MIDlet:
a more Realistic Example
Which possible issues in a real usage scenario?
Development/Runtime Platforms – Mobile Systems M 35
MIDlet:
a more Realistic Example
Which possible issues in a real usage scenario?
❑ NO GUI feedback during the time interval needed for connection
establishment => «no-waiting» user that generates other useless
commands…
❑ Most relevant: threading model
➢ System threads are “offered” for MIDlet execution
➢ The only threads fully and exclusively owned by a MIDlet
are the ones that MIDlet explicitly instantiates
➢ As in other technologies, e.g., for GUI management: a system
thread works as event dispatcher; event managers have to
rapidly return control in order not to block the MIDlet
interface
Therefore, the «right and sound» solution would be…
Development/Runtime Platforms – Mobile Systems M 36
public void commandAction(Command c, Displayable s) {
if (c == mExitCommand)
notifyDestroyed();
else if (c == mConnectCommand) {
Thread t = new Thread() {
public void run() {
connect(); }
};
t.start(); }
}
MIDlet:
a more Realistic Example
Which possible issues in this case?
Development/Runtime Platforms – Mobile Systems M 37
SingleWorker class…
public synchronized void run() {
while (mTrucking) {
try { wait(); }
catch (InterruptedException ie) {}
if (mTrucking) connect(); }
}
public synchronized void go() {
notify(); }
SingleMIDlet classimport java.io.*;
…
public class SingleMIDlet extends MIDlet implements CommandListener {
private Display mDisplay;
private Form mMainForm, mWaitForm;
private SingleWorker mWorker;
private Command mExitCommand, mConnectCommand, mCancelCommand;
…
MIDlet:
a more Realistic Example
Development/Runtime Platforms – Mobile Systems M 38
public void startApp() {
mDisplay = Display.getDisplay(this);
if (mMainForm == null) {
//preparazione form
…
mWorker = new SingleWorker(this, url);
mWorker.start(); }
mDisplay.setCurrent(mMainForm); }
public void commandAction(Command c, Displayable s) {
if (c == mExitCommand) notifyDestroyed();
else if (c == mConnectCommand) {
mDisplay.setCurrent(mWaitForm); mWorker.go(); }
else if (c == mCancelCommand) {
mDisplay.setCurrent(mMainForm); mWorker.cancel(); }
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {
mWorker.stop();
} …
MIDlet:
a more Realistic Example
Development/Runtime Platforms – Mobile Systems M 39
J2ME: Types of
Supported Web Connections
❑ HTTP/HTTPS➢ Simple to use
❑ XML over HTTP/HTTPSRecently most widespread usage thanks to availability of several
lightweight parsers
➢ Model: it creates object-based representation of a doc n memory, e.g., DOM
➢ Push: it parses a whole document, by distributing then events to the registered listeners, e.g., SAX
➢ Pull: it parses the document a part after the other (fragment), by returning a single element or tag
In addition, very often, exploitation of features defined in additional JSRs: among the others, JSR82 (Bluetooth), JSR179 (Location), JSR135 (Mobile Media), JSR180 (SIP), and JSR172 (Web Services)
Development/Runtime Platforms – Mobile Systems M 40
(optional) Exercise on J2ME:How to Design a MIDlet Application
❑ Identifying the target devices
❑ Identifying the profiles that are supported by those devices
❑ Developing the application ➢ For instance, if as a MIDlet because CLDC/MIDP is supported,
application suitable for cellphones and small pagers
❑ The development environment should be integrated with CLDC/MIDP: MIDP reference implementation http://www.oracle.com/technetwork/java/index-jsp-138820.html
❑ Possibility of execution (for validation and testing purposes) over MIDP emulators➢ For example, usage of J2ME Wireless Toolkit and ktoolbar to
create a project and to design, implement, configure, and validate a MIDlet
➢ Probably you will appreciate more working with Eclipse ME http://eclipseme.org/
Development/Runtime Platforms – Mobile Systems M 41
For example, Nokia J2ME SDK
Development/Runtime Platforms – Mobile Systems M 42
Remember:
MIDlet Upload Process
Web Page
JAM
Downloads
App
User
Selects
App
Advertise
App on
Web Page
Network TransferJava Application
Manager
(Name,
Version,
Size,
…)
Jar File
Descriptor
File
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 43
Optional Exercise on J2ME:How to Design a MIDlet Application
To design and develop a simple context-dependent
MIDlet (e.g., able to play sounds or multimedia files that are
differentiated depending on current user location), by exploiting
features of JSR 135 (known as Mobile Media API,
http://java.sun.com/products/mmapi/) and of JSR 179 (known as
Location API, different implementation more or less “easily”
available, e.g., http://code.google.com/p/openlapi/)
❑ Exploiting, as preferred, development tools and IDEs such as
JavaME Wireless Toolkit or Eclipse ME
Note that the support for “old-fashioned” technologies such
as Java ME is decreasing and decreasing…
Development/Runtime Platforms – Mobile Systems M 44
A Superficial Overview of
the Security Model
JME CANNOT support the regular and complete
security model of J2SE❑ The implementation of the only J2SE protection domains is
larger than the whole CLDC implementation (footprint)
Therefore, how to implement a security solution for JME?
Main guideline – to split the problem into two parts:
❑ VM-level security (low-level)
➢ Obtained via the 2-phase verifier for class files that is
included in CLDC
❑ Application-level security
➢ Sandbox model
Development/Runtime Platforms – Mobile Systems M 45
Security:
Class File Verifier in 2 Phases
❑ Off-device verification➢ Tool for pre-verification adds a “stack map” attribute to any method
in the Java class file in order to facilitate in-device verification
➢ Pre-verification process (computationally heavyweight) is run on
server/desktop side before that the class file is downloaded on
mobile device
➢ “stack map” then helps to make more efficient the in-device
verification
▪ Faster
▪ Less code in VM and minor memory consumption
❑ In-device verification➢ Environment verification (e.g., memory requirements at runtime)
➢ Bytecode check
➢ Type check
➢ “Proper” termination, i.e., adequate and robust (e.g., no instructions
for unconditional jump)
Development/Runtime Platforms – Mobile Systems M 46
Stack map attribute grows the size of classfile of around 5%
Security:
Class File Verifier in 2 Phases
Development/Runtime Platforms – Mobile Systems M 47
Application-level Security:
Sandbox Model
Applications (MIDlets, but not only them) have to execute in a
close environment from where they can access only the
APIs defined by configuration, profile, and licensed classes
that are supported by the used deviceDo you remember the sandbox execution model for applets?
More specifically, MIDlet sandbox model specifies:❑ Class files have to pass an adequate verification step (to
guarantee they are valid)
❑ Only the APIs defined by CLDC, profile, and licensed extension
classes have to be available
❑ Application download occurs at so-called native layer (native
code level), mandatorily via the Java Application Manager (JAM)
❑ Forbidden to override the standard class loading mechanism
❑ Forbidden the access to the set of native functions that the VM can
instead use
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 48
Android: Architecture
Classical hierarchical architecture, structured into layers (growing complexity from bottom to top)
Layers:
❑ Linux kernel
❑ Libraries (native Linux)
+ Android runtime
(Dalvik VM + core
libraries)
❑ Application
Framework
❑ Applications
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 49
Android: Architecture
Kernel Layer❑Based on traditional Linux v3.x
kernel and evolutions❑ It introduces Hardware
Abstraction Layer (HAL)
Libraries❑ in native language (C/C++)
Android Runtime❑Execution environment for
applications, written in Java❑Based on Dalvik VM
Application Framework❑ It provides applications with
advanced services, encapsulated in Java objects,
Application❑Core Apps: provided by the
«initial» onboard system❑Developers’ written apps…
Development/Runtime Platforms – Mobile Systems M
Android:
Elements about Version Evolution
Ice Cream Sandwich 4.0.1 (October 2011)❑Linux kernel 3.0.1; customizable launcher; "Contacts" app fully integrated with main social network applications; Android Beam (data exchange via NFC); Wi-Fi Direct, etc. etc.
Development/Runtime Platforms – Mobile Systems M
Android:
Elements about Version Evolution
Jelly Bean 4.1.1 (July 2012)❑Linux kernel 3.1.10; new features for picture/video sharing via NFC; advanced voice recognition; official end of the support of Adobe Flash, etc. etc.
Kit Kat 4.4 (October 2013)Support for 3 new types of sensors (geomagnetic rotation vector, step detector and counter), added step counter feature; decreased battery consumption during audio playing; Android RunTime (ART) and new compiler, experimental in this version, that can be activated in Developers Options (not on all devices); optimized working on devices with limited RAM, …
Development/Runtime Platforms – Mobile Systems M
Android:
Elements about Version Evolution
Lollipop 5.0-5.1.1 (November 2014)Introduction of Google Fit for physical activity; new Linux 3.10.x. kernel;removal of Dalvik runtime, that is officially replaced by ART; native 64 bit support; Bluetooth 4.1; improvement of graphical performance thanks to OpenGL ES 3.1 support; improvement of camera support thanks to dedicated APIs; added multi-user features on smartphones; …
Marshmallow 6.0 (October 2015)Doze mode, with CPU speed reduction when display is switched off; native support to fingerprint readers; Direct Share for sharing among apps; request of post-install/run-time permissions; USB Type-C support; support to External storage to make it uniform to Internal Storage; MIDI support for music instruments; experimental multi-window feature
Development/Runtime Platforms – Mobile Systems M
Android:
Elements about Version Evolution
Nougat «N» 7.1.2 (August 2016) – API 25Ability to display multiple apps on-screen at once in a split-screen view; support for inline replies to notifications; OpenJDK-based Java environment; support for the Vulkan graphics rendering API; "seamless" system updates on supported devices; …
Oreo 8.0 (August 2017) – API 26Project Treble, i.e., modular architecture that makes it easier and faster for hardware makers to deliver Android updates; multi-display support
Pie 9.0 (August 2018) – API 28Experimental features (hidden within a menu called Feature Flags) such as automatic Bluetooth enabling while driving; DNS over TLS; Vulkan 1.1 -low-overhead, cross-platform 3D graphics and computing API
Development/Runtime Platforms – Mobile Systems M
Android versions by term
54
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 55
Kernel Linux 3.x
Hardware Abstraction Layer (HAL)
❑ Memory management
❑ Process management
❑ Network stack
❑ Standard Linux power management
❑ …
55
Kernel extensions❑ Ashmem: shared memory manager;
reference counting and automatic deallocation by the kernel
❑ IPC binder: low overhead thanks to the usage of Ashmem (rigid access discipline via memory block descriptors)
❑ Advanced power management: exploitation of different energy management policies via WakeLocks
Android:
OS Kernel Layer
It is NOT a real complete Linux OS kernel. It lacks:❑ Native window manager system
❑ Complete support to GNU C library
❑ Complete support to standard Linux utilities
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 56
Power Management
and WakeLocks
Manifest example of cross-layering
Android apps (with permission to access Power Manager) can achieve control of energy consumption by enforcing the desired policy:
❑ Always active CPU, also with switched-off display
❑ Prioritary CPU with display that is at least backlit
❑ …
Via WakeLocks: access locks to the features of Power Manager (different types of WakeLock). For instance:
… @Override
protected void onCreate(Bundle savedInstanceState) {
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "DoNotDimScreen"); }
@Override
protected void onPause() { super.onPause(); wl.release(); }
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 57
Native libraries for graphics and multimedia
Dalvik VM❑ designed for mobile devices: registry-based (exploiting the ARM
architecture). Instead, how is the traditional JVM organized?
❑ It interprets and runs dex files, obtained via transformation of class files
(30% reduction of necessary instructions and improvement of runtime perf)
❑ optimized support to garbage collection
Android:
Native Libraries and Dalvik VM
Surface Manager + Media Framework
3D Surface3D Surface3D Surface3D Surface
2D Surface2D Surface2D Surface2D Surface
SurfaceSurfaceFlingerFlingerSurfaceSurfaceFlingerFlinger
FrameFrameBufferBufferFrameFrameBufferBuffer
Audio Flinger
Audio Audio FlingerFlinger
App App App App
CameraCamera
Camera
Service
Camera
Service
OpenCOREOpenCOREVorbisVorbis MIDIMIDI
Media Player Service
Media Player Service
Media RecorderService
Media RecorderService
Media Server
CameraCamera
Camera
Service
Camera
Service
OpenCOREOpenCOREVorbisVorbis MIDIMIDI
Media Player Service
Media Player Service
Media RecorderService
Media RecorderService
CameraCamera
Camera
Service
Camera
Service
OpenCOREOpenCOREVorbisVorbis MIDIMIDI
Media Player Service
Media Player Service
Media RecorderService
Media RecorderService
Media Server
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 58
Activity❑ A single action that one user can accomplish via a window (itcorresponds usually to a single screen)❑ It is the fundamental Androidcomponent
➢ E.g., home activity
Intent❑ Maximum reusability of activity❑ Request to perform an operation (e.g., choice of a phone number)❑ Received by a component that has a compatibile Intent Filter
Service❑ Running in background (no interaction with user, differently from activity)❑ Usable by 1+ components❑ No dedicated process/thread in background
Broadcast Receiver❑ Responds to compatible Intents by executing the associated operations❑ Typically, notify actions (calls, sms transmissions, …)❑ Lifecycle is limited to the response❑Differently from activities and services, multiple receivers can be activated by a single intent
Android:
Application Framework
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 59
❑ Package and Activity ManagerManage the lifecycle of Activities and apps, included in Android Packages (APK). Each APK includes a descriptor (manifest), executable dex, and the associated «static» resources (xml, png, …), according to a predefined file structure
❑ Window Manager and View SystemOffer advanced graphics features that can be used directly in apps. View System is based on the View class, and consists of GUI components that interact with user and with event managers (no Java Swing, no AWT)
Applications
❑ Resource Manager and Content
ProviderResource manager for any resource (all files except for code) and shared access to local data (SQLite RDBMS and persistence through files)
❑ Telephony, Notification, and Location Manager
Allow to access functionality for telephony, notification, and positioning
Android: Application Framework
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 60
Core Applications
Real and regular apps (same execution model as for apps developed by
third parties and downloaded by users), pre-installed at default over an Android device
➢ Home application (and associated activity): manager app frm which it is possible to launch execution of other apps. Which threading model?
➢ Message management
➢ Client app for email
➢ Contact book
➢ Map management
➢ Web browser: WebKit browser engine
(open-source); used also in Safari and
Google Chrome
Only browser engine (HTML parser +
renderer + JavaScript engine)
Applications
Android: Core Applications
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 61
Lifecycle Management of
Android Activities
❑Activity is the component for user
interaction❑It extends the Activity Java class
❑In general, many activities are running
concurrently: the active one
(RUNNING) is only ONE. If visible but
not active, it is PAUSED, otherwise
STOPPED
❑For lifecycle management, it is
possible to redefine callback
methods OnCreate, OnStart,
OnResume,…
❑Activities use resources: an activity
may be deallocated due to resource
shortage → KILLED state
❑Android offers an info container
called Bundle, where to save the
state to be recovered at re-allocation
STOPPED
OnCreate()
OnStart()
OnResume()
RUNNING
a) New activityb) Back button
OnPause()
PAUSED
Activity is no more visible
OnStop()
OnDestroy()
INACTIVE
Activity comesback in foreground
Activity comesback in
foreground
OnRestart()
Resource shortage
INACTIVE
(KILLED)
Activity comesback in foreground
OnRestoreInstanceState(Bundle)
OnSaveInstanceState(Bundle)
Bundle
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 62
Conversation Concept:
Android TaskOne App may include several activities:
❑ Independent and disjoint
❑ Associated the one with the other
Activities are different from forms
❑ They should be simple
❑ They should be usable and reusable
→ there is the need to structure activities to
compose a more complex conversation
with user (as for Web pages)
A task models a conversation
❑ It includes an activity stack, also of
different apps: on top the only active
activity in the task
❑ Activity start pushes it on top of the
stack; its closing discards the activity
from the stack
❑ It may be in foreground or in
background
MyFirstProject
it.mypackage
process
MyActivity
App Dialer
Dialer process
Contacts
Dialer
…
MyActivity
Contacts
TASK
root activity
top of the
stack
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 63
Intent and Intent Filter
Activation of a component is triggered by an Intent(usually to pass from an activity to the following one)
❑ explicit: component to activate is known at compile time; it needs the Class descriptor of the component
❑ implicit: component to activate is NOT known at compile time; it needs that the following data are specified
➢ action and category: they describe respectively action and type of the component to activate for execution
➢ url: it specifies data to be processed by the activated component
➢ mime type: it specifies the data type usedIntent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(“http://www.unibo.it”));
Component is selected based on applicable Intent Filters (description of which intents an activity can handle) that are declared in the manifest, according to an algorithm of Intent Resolution
Intent repository on www.openintents.org
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 64
Intent and Intent Filter
protected void onCreate(Bundle savedInstanceState) {
...
Intent intent = new Intent(); intent.setAction(MY_ACTION);
intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
Uri uri = Uri.parse("content://it.mypackage/items/");
intent.setData(uri);
intent.setType("vnd.android.cursor.item/vnd.mytype");
startActivity(intent); ... }
<activity android:name="IntentActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.
LAUNCHER" />
<category android:name="it.mypackage.intent.
category.CAT_NAME" />
<data android:mimeType="vnd.android.cursor.item/
vnd.mytype" />
</intent-filter>
</activity>
Example
of
manifest
file
Development/Runtime Platforms – Mobile Systems M 65
Threading Model in Android
Each application has a single thread (at default) =>
simple single-threaded model (1 app: 1 thread)
❑ 1 app: 1 system thread “assigned” to the app: multiple activities
❑ Possibility to save the state in info bundle (not very different from
execution model of stateful session beans in J2EE)
❑ Each thread has a Looper for message queue management
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 66
Threading Model in Android
Two options: 1) to launch different apps in a single Dalvik VM (single
heavy process); 2) to have a single Dalvik VM (process) dedicated
to each single app
The default is the second option: any app is put in execution into a
separated VM (separated isolated process), also when triggered by
startActivity(intent) or startService(intent)
How is it possible? Which potential issues?
For instance, how to perform response return to the «invoking» activity?
startActivityForResult(Intent, int)
second parameter identifies the call
callback function onActivityResult(int, int, Intent)
If it is crucial to optimize system resource consumption, there is the need
to impose that different apps share the same userID
Android.sharedUserId=“PaoloBellavista” in manifest file
Which potential security issues?
Development/Runtime Platforms – Mobile Systems M
Android Scheduling
1. Foreground
2. Visible
3. Service
4. Background
Process level:
App A
App A
Foreground Thread Group
Background Thread Group
App B
App B
> 90%
< 10%
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
67
Development/Runtime Platforms – Mobile Systems M
Asynchronous Techniques
❑ Thread
❑ Executor
❑ HandlerThread
❑ AsyncTask
❑ Service (already partially discussed)
❑ IntentService
❑ AsyncQueryHandler
❑ Loader
68
Development/Runtime Platforms – Mobile Systems M
Android Threads
❑ Act much like usual Java Threads
❑ Cannot work directly on external User Interface objects (throw the Exception CalledFromWrongThreadException: “Only the original thread that created a view hierarchy can touch its views”)
❑ Cannot be stopped by executing destroy() nor stop(). Use instead interrupt() or join() (by case)
❑ As usual, two main ways of having a Thread that executes application code:➢ Providing a new class that extends Thread and
overriding its run() method
➢ Providing a new Thread instance with a Runnable object during its creation.
In both cases, start() method must be explicitly called to actually execute the new Thread
69
Development/Runtime Platforms – Mobile Systems M
Android Handler
❑ Associated with a single thread and that thread's message queue
❑ Bound to the thread/message queue of the thread that has created it
❑ It delivers messages and runnables to that message queue
❑ It executes them as they come out of the message queue
Two main types of usage for a Handler:
➢ To schedule messages and runnables to be executed as some point in the future
➢ To add an action into a queue performed on a different thread
70
Development/Runtime Platforms – Mobile Systems M
Handler Example
71
Development/Runtime Platforms – Mobile Systems M
Android AsyncTask
❑ Created on the UI thread and can be executed only once
❑ Run on a background thread and result is published on the UI thread
❑ The three parameters of an AsyncTask are:➢ Params, the type of the parameters sent to the async task upon
execution
➢ Progress, the type of the progress units published during the background computation
➢ Result, the type of the result of the background computation
❑ Go through 4 steps:➢ onPreExecute(): invoked on the UI thread immediately after the
async task is started
➢ doInBackground(Param ...): invoked on the background thread immediately after onPreExecute() finishes executing
➢ onProgressUpdate(Progress...): invoked on the UI thread after a call to publishProgress(Progress...)
➢ onPostExecute(Result): invoked on the UI thread after background computation finishes
72
Development/Runtime Platforms – Mobile Systems M
AsyncTask Example
73
Development/Runtime Platforms – Mobile Systems M
❑ Violate the single thread model: the Android UI toolkit is not
thread-safe and must always be manipulated on the UI thread
❑ In this piece of code, ImageView is manipulated on a worker
thread, which can cause really weird problems. Tracking down
and fixing such bugs can be difficult and time-consuming
To Summarize: Pay Attention…
74
Development/Runtime Platforms – Mobile Systems M
❑ Classes and methods also tend to make the code more complicated and more difficult to read
❑ It becomes even worse when implementing complex operations that require frequent UI updates
To Summarize: Pay Attention…
75
Development/Runtime Platforms – Mobile Systems M
To Summarize: Pay Attention…
76
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 77
Example: Developing a Launcher
for Replacing the usual Home
A custom home can be created by:
1. Defining a new Activity
2. Declaring the launcher’s action MAIN in
the Intent Filter
3. Searching installed apps via Package
Manager
4. Selecting the only apps that have an Intent
Filter related to launch
5. Creating a selection View (Button) for each
suitable app
6. Defining the click event: Intent notification
7. Association of the event to the View
As already mentioned, home allows starting any app, serving as a launcher
Android as an open platform – “All Apps are created equal” → it is possible to
customize the system with our own home
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 78
// Step 1: definition of a new activity
public class CategoryTestActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LinearLayout activitiesList;
activitiesList = (LinearLayout)
findViewById(R.id.activitiesList);
// Steps 3 and 4: app search and selection based on IntentFilter
Intent intent = new Intent();
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
PackageManager pkgManager = getPackageManager();
List<ResolveInfo> activities =
pkgManager.queryIntentActivities(intent, 0);
…
Example: Developing a Launcher
for Replacing the usual Home
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 79
…
for (ResolveInfo resolveInfo : activities) {
final ResolveInfo ri = resolveInfo;
Button button = new Button(this); //Step 5: one button per app
button.setText(resolveInfo.loadLabel(pkgManager));
// Step 7: event-view association
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(); //Step 6: intent launch
ComponentName cn = new ComponentName(ri.
activityInfo.packageName, ri.activityInfo.name);
intent.setComponent(cn);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
startActivity(intent);}});
activitiesList.addView(button);}}}
Example: Developing a Launcher
for Replacing the usual Home
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 80
<manifest xmlns:android=“...” package="it.mypackage">
<application android:label="@string/app_name">
<activity android:name=".HomeActivity"
android:label="@string/app_name">
<intent-filter> <!– Step 2 -->
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.
HOME"> </category>
<category android:name="android.intent.category.
DEFAULT"></category>
</intent-filter>
</activity>
</application>
</manifest>
Example: Developing a Launcher
for Replacing the usual Home
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 81
Android Security
in a Single Slide
<manifest xmlns:android="http://schemas.android.com/apk/res/
android“ package="com.google.android.app.myapp" >
<uses-permission id="android.permission.RECEIVE_SMS" />
</manifest>
Typical guidelines for security in Linux
❑ At default any Android app runs in a dedicated Dalvik VM
and within its own separated process. Which UID/GID?
➢ Process and group identifiers are selected from an interval that is
defined system-level: FIRST_APPLICATION_UID, LAST_APPLICATION_UID
❑ Process-level permissions are assigned and controlled
depending on user ID & group ID assigned to
processes. Typically what do you expect?
❑ Finer-grained permissions are assigned (and revocable) even for a
single operation via manifest file
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 82
Exercise on Android
To design and develop a simple context-dependentAndroid app (for example, able to play different audio/video files
depending on current user location), by employing the APIs of the Media Framework library (native) and the APIs of the Location Manager (Java-based, application framework level)
Suggestion to use, but free personal choice ☺:
❑ Android Studio and SDK toolshttps://developer.android.com/studio/index.html
It could be the initial starting seed for a possible project activity…
As additional examples of Android usage and project activities, please see alsohttp://lia.disi.unibo.it/Courses/sm1415-info/esercizi.html
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 83
Many and Many Available Sources
for Additional InfoMany good (not only good ) books on Android:
❑ E. Hellman, “Android Programming: Pushing the Limits”, Wiley,
Nov. 2013
❑ Z. Mednieks, L. Dornin, “Programming Android: Java Programming
for the New Generation of Mobile Devices”, O’Reilly, Ott. 2012
❑ R. Meier, “Professional Android 4 Application Dev.”, Wrox, 2012
❑ F. Ableson, R. Sen, “Android in Action”, Manning, Feb. 2011
Android SDK has good manuals and how-tos, e.g., description of
available APIs, presentation of examples of apps, …
❑ http://developer.android.com/sdk/index.html
Further info and documents are available at the Android Studio Web site:
❑ https://developer.android.com/studio/index.html
Development/Runtime Platforms – Mobile Systems M 84
iOS (or iPhoneOS):
a Very Rapid OverviewApproach is very similar to Android from many perspectives and
in terms of realization of a wide support ecosystem, i.e.,
development model + support API:
❑ iOS exploits a variant of the XNU kernel, which is at the basis of
MacOSX
❑ Chain of development tools is similarly based on Xcode
SDK includes APIs at different layers to support:
SDK also includes iPhone Simulator, i.e., a tool to emulate iPhone look&feel
over developer desktop. It is not a real emulator: it runs code that is actually
generated for another target (x86)
SDK requires a Mac OS X Leopard host (or more recent)
➢Events and multi-touch controls
➢Accelerometer
➢Localization (i18n)
➢Camera and media in general (audio
mixing&recording, video playback, several image
file formats, OpenGL ES …)
➢Networking
➢Embedded SQLite database
➢Core Location (GPS, Skyhook WiFi, …)
➢Thread
➢Power management
➢File system
➢Security
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 85
iOS (or iPhoneOS):
Rules Rules Rules…
❑ 3.3.1 — Applications may only use Documented APIs in the manner
prescribed by Apple and must not use or call any private APIs.
Applications must be originally written in Objective-C, C, C++, or
JavaScript as executed by the iOS WebKit engine, and only code written in
C, C++, and Objective-C may compile and directly link against the
Documented APIs
❑ 3.3.2 — An Application may not itself install or launch other executable
code by any means, including without limitation through the use of a plug-in
architecture, calling other frameworks, other APIs or otherwise. No
interpreted code may be downloaded or used in an Application except for
code that is interpreted and run by Apple’s Documented APIs and built-in
interpreter(s)
Even the SDK can be downloaded for free but calls for registration to
iPhone Developer Program if developers are willing to release some
software (paying a fee + subject to Apple’s approval)
Apple has not announced any plan for supporting Java over iPhones;
initially some partial support instead for J2ME over iOS
Development/Runtime Platforms – Mobile Systems M 86
How to Develop in iOS:
First Steps
To start:
❑ http://developer.apple.com/iphone/
❑ Download the iOS SDK, which includes:
➢ Xcode
➢ iPhone emulation tools
➢ Monitoring tools
➢ Interface builder
Please note that apps are subject to Apple’s approval (included in the
signed agreement for SDK download), with the idea of performing
reliability tests and other investigations…
Apps may be rejected if evaluated as of "limited utility"
Development/Runtime Platforms – Mobile Systems M 87
Alternative Possibilities for
iOS Development
Primary option: exploitation of Xcode and Objective C,
exactly same way as in traditional MacOSX
Alternatively:
❑ Web applications that employ AJAX/Javascripttechnologies; HTML5 set of solutions; possibility to access via Safari
❑ Also (but rare) usage of Java
➢ AlcheMo for iPhone
➢ Xmlvm
➢ Java installation over “unlocked” and “jailbroken” iPhone
By the way, do you know what the terms “unlocking” and “jailbreaking” mean?
Development/Runtime Platforms – Mobile Systems M 88
Unlocking & Jailbreaking
To be precise, unlocking and jailbreaking identify two different procedures
❑ Unlocking is the process through which a device is made compatible with telco networks for which it was not specifically licensed (overcoming the locking with a given dedicated telco operator)
❑ Jailbreaking is the process through which a developer exits her own “jail” in UNIX-like OS and/or breaks the imposed system of Digital Right Management (DRM). It is a specific form of growth of execution privilege
❑ In iOS, it allows a user to execute arbitrary code and apps, by bypassing the regular mechanism of distribution of Apple code (based on iTunes App Store and iTunes Application)
To enjoy yourself ☺ with experimentation, tools such as:
➢ PwnageTool, QuickPwn, Yellowsn0w http://blog.iphone-dev.org/
➢ Pusher - http://ripdev.com/pusher/
➢ Linux on iPhone - http://www.iphonelinux.org/index.php/Main_Page
➢ ZIPhone - http://www.ziphone.org/
Development/Runtime Platforms – Mobile Systems M
Cross platform based on HTML5
89
Development/Runtime Platforms – Mobile Systems M
Cross platform based on HTML5
90
Development/Runtime Platforms – Mobile Systems M
Cross platform - Xamarin
91
Development/Runtime Platforms – Mobile Systems M
Cross platform - Xamarin
92
Development/Runtime Platforms – Mobile Systems M 93
iOS:
AJAX & JavaScript
AJAX (“maybe” Asynchronous JavaScript and XML): set of correlated
techniques for the development of highly interactive Web applications (rich Internet applications)
❑ Possibility of asynchronous data retrieval in background, with no interference on behavior and visualization of current page
➢ To some extent and from some perspectives, applets as AJAX precursors
❑ With Safari browser, possibility of highly interactive and “native looking” Web applications
Question: which pros in using Web applications in place of native apps?
❑ AJAX plugin per Eclipse (available also as a standalone version): http://www.aptana.com/
Development/Runtime Platforms – Mobile Systems M 94
Also proposals that succeeded in terms of standardization.
For example:
❑ Canvas element as third-party JavaScript extension that allows dynamic rendering of bitmap images
➢ Introduced by Apple for usage within Webkit component of MacOSX (forming the basis of Safari browser), then adopted by Mozilla and Firefox
➢ Standardized by WHATWG (see last slide) for the new specification proposals towards HTML5
➢ Canvas is a “drawable” area defined in the HTML code, with attributes for height and size. JavaScript code can use a wide set of drawing functions, by allowing to use dynamically generated graphics (drawings, animations, image compositions/elaborations, …)
➢ In competition with Macromedia Flash/FlashLite. For instance, see these two examples:
▪ http://www.damonkohler.com/2008/12/javascript-painting-with-canvas.html
▪ http://www.benjoffe.com/code/demos/canvascape/
iOS:
AJAX & JavaScript
Development/Runtime Platforms – Mobile Systems MDevelopment/Runtime Platforms – Mobile Systems M 95
Web Applications:
HTML5 in a Single SlideAgain, the fundamental question is pros&cons of
Web applications vs. native apps
HTML5❑ Nothing of groundbreaking originality, it uses the traditional classical
model of Web applications with rich interactivity
❑ HTML5 = HTML + CSS + JavaScript
➢ W3C finalized it (at the end :-)!) in October 2014
By delving into finer details:
❑ New tags for AJAX and DHTML
❑ New tags for embedded management of audio and video files (e.g., <video> tag)
➢ To what extent are they currently supported? In a completely standard way?
❑ Better management of document structure
For example, see http://w3c.github.io/html/ (draft version 5.2 – April 18, 2017)
➢ http://slides.html5rocks.com/