introducing mobile platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/tamz-new-l1.pdf · generic mobile...

31
TAMZ 1 Lecture 1 Introducing Mobile Platforms Pavel Moravec

Upload: others

Post on 20-Apr-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

TAMZ 1Lecture 1

IntroducingMobile Platforms

Pavel Moravec

Page 2: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

2

Contact Information Name: Pavel MoravecOffice: EA-409 / IT-437Address: Dept. of Computer Science, FEECS

VSB-TU Ostrava17. listopadu 15708 33 Ostrava-Poruba

Phone: +420 59 732 5896 / +420 59 732 9585E-mail: [email protected]: http://wiki.cs.vsb.cz/index.php/Moravec/cz

Page 3: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

3

Course Requirements

During the semester:Implementation (10 points)

programming of certain assignments in labs, one point for each completed assignment

Presentation (5 to 10 points)presentation of pre-selected topic from subject area in labs, 10-15 minutes.

Project (10 to 25 points)implementation of chosen project for a mobile device + its defense. Required to complete the course !

Total sum (15 to 45 points)After the end of the semester:

Final exam (20 to 55 points)

Page 4: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

4

ReferencesOnsen UI 2: Beautiful HTML5 Hybrid Mobile App Framework and Tools https://onsen.io/ Apache Cordova API Documentation http://cordova.apache.org/docs/en/2.4.0/

W3 Schools: http://w3schools.com/

A. Kosmaczewski: Mobile JavaScript Application Development, O'Reilly Media, 2012

P. Retting: Professional HTML5 Mobile Game Development, John Wiley & Sons (14 Sep 2012)

J. M. Wargo: PhoneGap Essentials: Building Cross-platform Mobile Apps, Addison-Wesley Professional, 2012

jQuery Mobile API Documentation http://api.jquerymobile.com

J. Munro: 20 Recipes for Programming PhoneGap, O'Reilly M.

Page 5: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

5

What is a Mobile Device?

A pocket-sized computing device, typically with:a small visual display screen for user outputa miniature keyboard or touch screen for user input.

Examples:Mobile phonesSmartphones, TabletsNavigation devicesCameras, portable media playersHandheld game consolesIoT devices, monitoring devices, “smart” devices...

Page 6: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

6

Limitations of Mobile DevicesSmall (often lower-resolution) display (on some types of devices even grayscale/BW) on specialized devices Limited input options (phone/software touch keyboard)Lower operating memory & internal storage space (the latter partly solved by external memory cards)Limited CPU power + absent or limited GPU capabilitiesLimited instruction set (e.g. only software-emulated floating point arithmetic, no SSE, vector-processing instructions)Network connectivity issuesSmaller library of system functionsPower considerations...

Page 7: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

7

Mobile Operating SystemsVendor-specific firmware, vendor SDKs for custom buildsReal-time operating systemsiOS on Apple devicesLinux-based:

AndroidUbuntu MobileFirefox OS → KaiOS, Tizen, Sailfish OS, Jolla

Windows Windows Phone 8.x, Windows RT (8), Windows CE

BlackBerry OSSamsung BADASymbian OS

Page 8: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

8

Mobile FrameworksHTML5-based frameworks

AngularJS, Onsen UI, jQuery Mobile, Sencha Touch, vue.js, Game frameworks: i.e. Phaser, Quintus, … Cordova, Ionic, ReactNative, PhoneGAP, …

XamarinQTJava FX, CodeName OneGame frameworks: Unity 3D, Cocos 2D, Corona SDK, libgdx, …

Obsolete:Flash Lite – commercial, superseded by Adobe AIRJavaME – Java 2 Micro Edition, JavaFX

3rd party frameworks (of varying quality) based onJava-based, Python, LUA, …

Page 9: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

9

Programming languagesHTML5 + Javascript/TypeScript + CSS(3)Java – special-purpose devices, Android(*), libgdx, … Objective C, Swift – iOSC/C++ – native libraries, e.g. Android NDK, single-chip solutions, custom firmware development, QT, RTOSes

Processing language (Arduino)C# – Windows, Xamarin, Unity3D, .NET CFKotlin – AndroidLUA – some game frameworks, Smart TVs, OpenWRTPythonExotic choices: Shell script, PHP, ……

Page 10: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

10

New platforms changed everything!Device fragmentation → Platform fragmentation

Platform fragmentation is getting “better” in recent yearsVendors try to keep customer by vendor lock-in

Applications sold by vendors directly through their Play Store/AppStore/Marketplace/Market/...

2 dominant platforms on smartphones and tablets:Android iOS (~15%)Windows (Windows Phone 8/10, Windows Mobile) Blackberry (US) / Symbian (EU)

Feature phones may still offer Java ME, but they often don’t bother anymore, or use KaiOS (HTML5-based API)

Page 11: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

11

Why is platform fragmentation bad? Different environment

Different APIsDifferent programming languages (Java, Objective C, Swift, Kotlin, C#, C/C++, …)Different SDKs, specific OS needed for SDK and development (Windows, MacOS)

→ The code needs to be written several times We may use “Native libraries” (usually in C/C++)Platform-independent SDKs (e.g. CodeName One, JavaFX, QT)Android/JavaME – basic common parts in Java, GUI/API calls separatelyHTML 5 for simple applications – PhoneGap

Page 12: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

12

Best description of current situation

Source:http://www.root.cz/clanky/komiks-trvale-udrzitelny-

rozvoj/

English legend:Operation

Sustainable development

Phase 1:Confusion of tongues

Phase 2:iOS

AndroidWindows Mobile/PhoneFirefox OS KaiOS→ KaiOS

Chrome OSUbuntu Mobile

Sailfish OS (Jolla)

Page 13: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

13

Current multi-platform development

Core library (C, C++, C#, HTML5+CSS+JS, …)

Business LayerAccess Layer (Data Access, Service Access)

Data Layer

iOS

User interface

Application layer(using native API )

Objective C

Android

User interface

Application layer(using native API )

Java/NDK

Windows Phone

User interface

Application layer(using native API )

SilverLight/XNA

Page 14: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

14

Mobile Platforms Common Features

Page 15: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

15

Generic Mobile OS Architecture

Application framework (platform APIs)

Application (e.g. Web Browser)Native

Applications

Application management

software (AMS) Basic librariesand services

Virtual Machine*

OS Runtime

Host Operating System Kernel

* Virtual machine is not used on some platforms, which run native code directly.Usually, we use platform APIs for development, but on most platforms we can also write native code using built-in or even user-supplied libraries, or a HTML+JS+CSS application run in the web browser or embedded web view.

Page 16: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

16

Handling SecurityAny seriously considered mobile OS needs protection from malicious code that may access system information or resources.

Advanced security model provided by desktop OS may be too memory-consuming (although frameworks like SELinux have already been included in latest Android versions).

The classic security model, which is provided in most mobile devices, is the sandbox model, where the applications are run in a closed environment in which they can only access insensitive resources, the access outside of the sandbox must be granted by the user.

Typically, all sensitive APIs have to be listed in application manifest (in some cases the application using these APIs may have to be signed) and are part of a permission model.

Page 17: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

17

Java on Mobile Platforms

Page 18: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

18

Why is Java so popular?Java was originally intended for embedded and mobile development.Many old-time mobile developers were used to program in JavaME, which was easy-to understand platform with well-defined standards (jcp.org)

Still may be the only choice for feature phones Android uses Java bytecode as a step in developing mobile applications. Java-base SDKs (Netbeans/Eclipse) are available for all 3 major platforms (Windows, MacOS, Linux)But you may develop HTML5 apps in them as well

Page 19: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

19

Official Java EditionsIn 1995 the first version of Java, now known as Java Platform Standard Edition (JavaSE), was released. Since that time its landscape has changed significantly.

Standard Edition (JavaSE)Designed to run on desktop and workstation computers.

Enterprise Edition (JavaEE)This edition is aimed at server-based applications. Contains buit-in support for Servlets, JSP and XML.

Micro Edition (JavaME)Designed for devices with limited memory, display and processing power.

Java Card – programming of Smart Cards (e.g. SIM, payment)

Page 20: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

20

Historical Android OS Architecture

Source: http://wipedia.org/wiki/File:Android-System-Architecture.svg

Page 21: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

21

Example of a formerly widespread mobile Platform

– Java ME

Page 22: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

22

Capabilities of devices within the JavaME may vary greatly. A PDA may have a much larger display than a pager. One Java platform will most definitely not fit all. In order to accommodate a broad range of consumer electronics and embedded devices JavaME introduces two new concepts: configurations and profiles.

Configurations and Profiles

Profile

Libraries

Java Virtual MachineConfiguration

Optional Packages (APIs)

Page 23: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

23

CDC is a subset of JavaSE, plus some extra classesCLDC is a subset of CDC.

CDC versus CLDC

JavaSE

CDC CLDC

Page 24: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

24

Connected Device ConfigurationThis configuration is designed for devices with more memory, faster processors and greater network bandwidth It is appropriate, at least in the near term, for home automation and automotive navigation, entertainment and telemetry systems.

A programming model closer to JavaSE simplifies porting existing desktop clients for enterprise systems to mobile devices that support CDC.

CDC has never been used much outside of Multimedia Home Platform (MHP) and some handheld game consoles.

Page 25: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

25

Connected Limited Device ConfigurationThis configuration is intended for devices with intermittent network connections, small processors and limited memory. Expected targets included two-way pagers, mobile phones and entry-level PDAs.

However, in practice, the functionality delivered by CLDC and the associated profiles and optional packages is very close to that of CDC. As a consequence it is used today on most high-end mobile phones, or smartphones, which are replacing PDAs in the marketplace.

Page 26: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

26

Java Language DifferencesThere are three main areas that distinguish the Java Language for CLDC to those defined in the Java Language Specification.

Floating Point MathThe CLDC 1.0 implementation of the Java language does not support floats. CLDC 1.1 specifies such support. But MIDP 2.0 only requires CLDC 1.0.

FinalizationThe CLDC does not support the finalize() method because an overhead and processor requirements are too steep.

Error HandlingThe JVM supports a limited set of error handling exceptions due a significant demand on the system's device-dependent.

Page 27: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

27

JavaME Java Virtual MachinesC virtual machine (CVM)classic Java virtual machine (not Dalvik!) used with CDC requires 32b microprocessorat least 2MB of RAM & 2.5 MB of ROM

Kilobyte virtual machine (KVM)used with CLDC 16b/32b (slow) microprocessorlimited math, string, and I/O functionslacks some features of classic JVMonly a small subset of JavaSE core librariesat least 32kB of RAM & 128kB of ROM

Page 28: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

28

ProfileA profile supplements a configuration to provide capabilities for a specific family of devices or specific industry segment application need.

For example, a configuration provides a generic Java API for battery powered, limited display and processing capability systems, while a profile provides a supplemental Java API specific to cellular telephones, which is a member of this larger group of devices. A profile must supplement a configuration.

A profile will not work without the configuration and virtual machine providing the core classes/API and runtime environment.

Page 29: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

29

ProfilesCDC profilesFoundation profile – basic CDC profileGame Profile – developing game applicationsPersonal Profile – complex UI components FPPersonal Basis Profile – simple UI components (single window)RMI Profile – Remote Method Invocation support classes

CLDC profilesMobile Information Device Profile – local storage, UI, networkPDA Profile – better displays, larger memory compared to MIDPKJava – Sun-specific API for Palm OSInformation Module Profile – subset of MIDP 1.0 without its display and input classes

Page 30: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

30

Mobile Information Device ProfileThe Mobile Information Device Profile (MIDP) is a key element of the Java 2 Platform, Micro Edition (JavaME). When combined with the Connected Limited Device Configuration (CLDC), MIDP provides a standard Java runtime environment for today's most popular mobile information devices, such as cell phones and mainstream personal digital assistants. The profile can be characterized by the following features:

rich user interface capabilitiesextensive connectivitymultimedia and game functionalityOver-the-air-provisioningend-to-end security

Page 31: Introducing Mobile Platforms - vsb.czwiki.cs.vsb.cz/images/0/0b/TAMZ-new-L1.pdf · Generic Mobile OS Architecture Application framework (platform APIs) Application (e.g. Web Browser)

31

MIDP Optional PackagesOnce again the basic library was insufficient for some applications (remember the JavaSE history), which resulted in the development of several new packages:

PDA Optional Package – more PDA-specific APIs, e.g. PIM, files Bluetooth API – Bluetooth communication (SDK problem)Wireless Messaging API – SMS (MMS) capabilitiesLocation API – location trackingPresence & IM API – JavaME version of JAIN, IM & presence support based on SIPMobile Media API – audio/video controls, streaming mediaJavaME Web Services API – Web Services-related XML classesSecurity and Trust API – Interaction with security smart cardMobile 3D Graphics API – 3D graphics, mainly for games...