Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of...

42
Department of Computer Science Institute for System Architecture, Chair for Computer Networks Application Development for Mobile and Ubiquitous Computing 9. Cross-Platform Development Dr. Ing. Thomas Springer Technische Universität Dresden Chair of Computer Networks

Transcript of Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of...

Page 1: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Application Development for Mobile and Ubiquitous Computing

9. Cross-Platform Development

Dr. Ing. Thomas Springer Technische Universität Dresden

Chair of Computer Networks

Page 2: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Lecture Structure

Dr. Thomas Springer Slide 2 Application Development - 9. Cross-Platform Development

Page 3: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Strong fragmentation of market for mobile device platforms

§  Market changes quickly

§  High update rate •  Device features •  Platform APIs

§  New form factors increase platform diversity, e.g. 7“ and 10“ tablets

Dr. Thomas Springer 3 Application Development - 9. Cross-Platform Development

Why Cross-Platform Development?

Page 4: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Why Cross-Platform Development?

Dr. Thomas Springer 4 Application Development - 9. Cross-Platform Development

Mobile Device

Dalvik VM +Core libraries

Hardware

Libraries

App.apk

App.apk ...

Application Framework

Linux Kernel

Mobile Device

Hardware

App.ipa

App.ipa ...

Media

Mach/BSD Kernel

Custom Frameworks

UIKit

FoundationCore Services

Cocoa Touch

Mobile Device

Hardware

App.xap

App.xap ...

App Model

Hardware Foundation

Silverlight

Kernel

UI Model Cloud Integration

XNA HTML/JavaScriptCommon Language Runtime

Frameworks

Android Project

iOS Project

Windows Phone Project

Page 5: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  High development effort •  Know-how for multiple platforms •  High update rates of technologies •  Customers don‘t pay per platform but for project

§  Short time to market •  Fast support of platform changes/new platforms

§  High maintenance effort

•  Manage multiple code bases •  Avoid inconsistencies

§  Mobility/Adaptation Support

Dr. Thomas Springer 5 Application Development - 9. Cross-Platform Development

Problem description

Page 6: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Write once, run everywhere?

Dr. Thomas Springer 6 Application Development - 9. Cross-Platform Development

Mobile Device

Dalvik VM +Core libraries

Hardware

Libraries

App.apk

App.apk ...

Application Framework

Linux Kernel

Mobile Device

Hardware

App.ipa

App.ipa ...

Media

Mach/BSD Kernel

Custom Frameworks

UIKit

FoundationCore Services

Cocoa Touch

Mobile Device

Hardware

App.xap

App.xap ...

App Model

Hardware Foundation

Silverlight

Kernel

UI Model Cloud Integration

XNA HTML/JavaScriptCommon Language Runtime

Frameworks

Cross-Platform Project

Page 7: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

How can we achieve it?

Dr. Thomas Springer 7 Application Development - 9. Cross-Platform Development

Cross-Platform Project

Mobile Device

Dalvik VM +Core libraries

Hardware

Libraries

App.apk

App.apk ...

Application Framework

Linux Kernel

Mobile Device

Hardware

App.ipa

App.ipa ...

Media

Mach/BSD Kernel

Custom Frameworks

UIKit

FoundationCore Services

Cocoa Touch

Mobile Device

Hardware

App.xap

App.xap ...

App Model

Hardware Foundation

Silverlight

Kernel

UI Model Cloud Integration

XNA HTML/JavaScriptCommon Language Runtime

Frameworks?

Page 8: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Heterogeneous Hardware •  Form factors •  Resources •  Device features (touch input, buttons, connectivity, sensors, …)

§  Heterogeneous Software Platforms •  Execution environment •  Programming languages •  Platform APIs, UI Kit •  App anatomy and programming model •  Tool chains •  Deployment and verification process

§  User expectations •  Native Look and Feel •  Design guidelines

Dr. Thomas Springer 8 Application Development - 9. Cross-Platform Development

Challenges

Page 9: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  A device platform is a combination of device hardware, operating system, runtime system, libraries, and frameworks forming a standard execution environment for applications on devices which run that platform.

§  A device platform has a characteristic set of features: •  Specific „look and feel“ (UI guidelines and interaction concepts) •  App runtime defining app anatomy and lifecycle •  Developer tool chain (programming languages, libraries, APIs) •  Specific app distribution and deployment process

§  Native Code is code which can be directly executed within the standard execution environment of the device platform. It has full access to the platforms libraries and frameworks, possibly also to operating system APIs and hardware features.

Dr. Thomas Springer 9 Application Development - 9. Cross-Platform Development

Terms and Definitions Device Platform

Page 10: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  An App is a specific type of applications created for and running on a particular device platform.

§  A Native App is an App which is created for and can be deployed and started on a device platform whithout any further dependencies.

§  A Mobile App is typically created for and running on a mobile device platform. It‘s started from the home screen, supports graphically-oriented interactions and occupies the full screen.

Dr. Thomas Springer 10 Application Development - 9. Cross-Platform Development

Terms and Definitions App

Page 11: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Mobile App Types

Dr. Thomas Springer 11 Application Development - 9. Cross-Platform Development

Device Platform

Interpreter

Cross-Platform App (+ Native Ext.)

Cross-Platform API

Native Code

Interpreted App

Web browser

Web App

Hybride App

Page 12: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  What to start with?

Dr. Thomas Springer 12 Application Development - 9. Cross-Platform Development

Cross-Platform Development Approaches

Execution PhaseBuild PhaseImplementationPhase

Mobile Device

Source Code Executable

Program

Design Phase

Model

GUILogic

GUILogic

Page 13: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Model-driven Development

Dr. Thomas Springer 13 Application Development - 9. Cross-Platform Development

Cross-Platform Development Approaches

Execution PhaseBuild PhaseImplementationPhase

Model-to-Model-Transformation

Mobile Device

Source Code Executable

Program

Design Phase

Model

GUILogic

GUILogic

Model-to-Code-Transformation

Interpretation

Page 14: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Cross-compilation to native code

Dr. Thomas Springer 14 Application Development - 9. Cross-Platform Development

Cross-Platform Development Approaches

Execution PhaseBuild PhaseImplementationPhase

Machine Code

Cross-Compilation / JIT-Compilation

Model-to-Model-Transformation

Execution

Mobile Device

Source Code Executable

Program

Design Phase

Model

GUILogic

GUILogic

Model-to-Code-Transformation

Interpretation

Page 15: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Support for abstract runtime

Dr. Thomas Springer 15 Application Development - 9. Cross-Platform Development

Cross-Platform Development Approaches

Execution PhaseBuild PhaseImplementationPhase

Machine Code

Byte Code

Cross-Compilation / JIT-Compilation

Model-to-Model-Transformation

Interpretation

AOT- / JIT-Compilation

Execution

Compilation

Mobile Device

Source Code Executable

Program

Design Phase

Model

GUILogic

GUILogic

Model-to-Code-Transformation

Interpretation

Page 16: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Script languages

Dr. Thomas Springer 16 Application Development - 9. Cross-Platform Development

Cross-Platform Development Approaches

Execution PhaseBuild PhaseImplementationPhase

Machine Code

Byte Code

Cross-Compilation / JIT-Compilation

Model-to-Model-Transformation

Interpretation

Interpretation

AOT- / JIT-Compilation

Execution

Compilation

Mobile Device

Source Code Executable

Program

Design Phase

Model

GUILogic

GUILogic

Model-to-Code-Transformation

Interpretation

Page 17: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Translate to other programming languages

Dr. Thomas Springer 17 Application Development - 9. Cross-Platform Development

Cross-Platform Development Approaches

Execution PhaseBuild PhaseImplementationPhase

Machine Code

Byte Code

Cross-Compilation / JIT-Compilation

Model-to-Model-Transformation

Source-to-Source-Translation (Code Transformation)

Interpretation

Interpretation

AOT- / JIT-Compilation

Execution

Compilation

Mobile Device

Source Code Executable

Program

Design Phase

Model

GUILogic

GUILogic

Model-to-Code-Transformation

Interpretation

Page 18: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Cross-Platform Development Approaches

Dr. Thomas Springer 18 Application Development - 9. Cross-Platform Development

Execution PhaseBuild PhaseImplementationPhase

Machine Code

Byte Code

Cross-Compilation / JIT-Compilation

Model-to-Model-Transformation

Source-to-Source-Translation (Code Transformation)

Interpretation

Interpretation

AOT- / JIT-Compilation

Execution

Compilation

Mobile Device

Source Code Executable

Program

Design Phase

Model

GUILogic

GUILogic

Model-to-Code-Transformation

Interpretation

Page 19: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Translation Approach

Dr. Thomas Springer 19 Application Development - 9. Cross-Platform Development

Translation Approach

Execution PhaseBuild PhaseImplementationPhase

Machine Code

Byte Code

Cross-Compilation / JIT-Compilation

Model-to-Model-Transformation

Source-to-Source-Translation (Code Transformation)

Interpretation

Interpretation

AOT- / JIT-Compilation

Execution

Compilation

Mobile Device

Source Code Executable

Program

Design Phase

Model

GUILogic

GUILogic

Model-to-Code-Transformation

Interpretation

Page 20: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Interpretation Approach

Dr. Thomas Springer 20 Application Development - 9. Cross-Platform Development

Interpretation Approach

Translation Approach

Execution PhaseBuild PhaseImplementationPhase

Machine Code

Byte Code

Cross-Compilation / JIT-Compilation

Model-to-Model-Transformation

Source-to-Source-Translation (Code Transformation)

Interpretation

Interpretation

AOT- / JIT-Compilation

Execution

Compilation

Mobile Device

Source Code Executable

Program

Design Phase

Model

GUILogic

GUILogic

Model-to-Code-Transformation

Interpretation

Page 21: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Web-based Approach

Dr. Thomas Springer 21 Application Development - 9. Cross-Platform Development

Interpretation Approach

Translation Approach

Execution PhaseBuild PhaseImplementationPhase

Machine Code

Byte Code

Cross-Compilation / JIT-Compilation

Model-to-Model-Transformation

Source-to-Source-Translation (Code Transformation)

Interpretation

Interpretation

AOT- / JIT-Compilation

Execution

Compilation

Mobile Device

Source Code Executable

Program

Design Phase

Model

GUILogic

GUILogic

Model-to-Code-Transformation

Interpretation

Web-based Approach

Page 22: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Hybrid Approach

Dr. Thomas Springer 22 Application Development - 9. Cross-Platform Development

Interpretation Approach

Translation Approach

Execution PhaseBuild PhaseImplementationPhase

Machine Code

Byte Code

Cross-Compilation / JIT-Compilation

Model-to-Model-Transformation

Source-to-Source-Translation (Code Transformation)

Interpretation

Interpretation

AOT- / JIT-Compilation

Execution

Compilation

Mobile Device

Source Code Executable

Program

Design Phase

Model

GUILogic

GUILogic

Model-to-Code-Transformation

Interpretation

Web-based Approach

Hybrid Approach

Page 23: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Model-driven Approach

Dr. Thomas Springer 23 Application Development - 9. Cross-Platform Development

Interpretation Approach

Translation ApproachModel-driven Approach

Execution PhaseBuild PhaseImplementationPhase

Machine Code

Byte Code

Cross-Compilation / JIT-Compilation

Model-to-Model-Transformation

Source-to-Source-Translation (Code Transformation)

Interpretation

Interpretation

AOT- / JIT-Compilation

Execution

Compilation

Mobile Device

Source Code Executable

Program

Design Phase

Model

GUILogic

GUILogic

Model-to-Code-Transformation

Interpretation

Web-based Approach

Hybrid Approach

Page 24: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Many tools and approaches

Dr. Thomas Springer 24 Application Development - 9. Cross-Platform Development

Page 25: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Dr. Thomas Springer 25 Application Development - 9. Cross-Platform Development

Example EMODE Model-Driven Approach

Execution PhaseImplementation/Build Phase

JavaME

Design Phase

RefinementAbstract Design

Task Model

Concept Model

Abstract UI Model

Functional-Core-Adapter

Model

Context-Model

Concrete UI Model

Executable Task Model

FCA-Code

Context-Provider-

Code

Source Code

Interpretation(EMODE-Runtime Environment)

other Platforms

...

M-M

M-M

M-M

M-C

M-C

M-C

M-C

M-M = Modell-to-Modell-TransformationM-C = Modell-to-Code-Transformation

§  Step-wise design and refinement §  Models for UI and application logic §  Integrated tool environment to consistently develop UI and

application logic

Page 26: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Qt C++ as source §  Virtual GUI toolkit §  Cross-platform libraries allow access to many device specific

features (camera, contacts, Maps, GPS, Sensors, etc.) §  Mobile APIs /Android, iOS, Blackberry 10): access to

hardware and mobile features (Sensors, Positioning, Bluetooth, NFC)

§  Qt Quick allows declarative description of touch-based UIs •  Interpreted in special runtime engine

Dr. Thomas Springer 26 Application Development - 9. Cross-Platform Development

Qt Translation Approach

Execution phaseBuild phaseImplementation phase

Qt C++-Sourcecode

C++-Sourcecode

...

Execution

Preprocessor

Machinecode

Symbian, MeeGo,Maemo,

Windows, Linux,

Mac OSMachine

code

...

Cross-Compilation

Execution

Page 27: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Java as common code base

§  Parameterized code to customize code for different platforms

§  Source-to-Source Translation to various programming languages

§  Transformed code can be further edited

§  Compatibility libraries per platform to bridge API-gap

§  No IDE, but translation scripts, compatibility lib and cross-compiler

Dr. Thomas Springer 27 Application Development - 9. Cross-Platform Development

webMethods Mobile Designer Translation Approach

Execution phaseBuild phase

Java-Quellcode

Implementation-phase

JavaME-Sourcecode

Source-to-Source-Translation C++-

Sourcecode

Java-Sourcecode

(Android)Dalvik-

Bytecode

Maschinen-code

Maschinen-code

C#-Sourcecode

ActionScript ActionScript-Bytecode

CIL-Code

CIL-Code

HTML5, JavaScript

JavaME

BlackBerry

Android

iOS,Bada,

Symbian, WinMobile,

webOS,BREW, ...

Windows Phone

Windows Desktop (.NET)

Flash Player

Browser

JavaME-Bytecode

BlackBerry-Bytecode

... ...

Realisation in webMethod Mobile Suite Integration with Paltform-SDKs

Compilation

Compilation

Compilation

Cross-Compilation

Cross-Compilation

Compilation

Compilation

Compilation

Interpretation

Interpretation

Interpretation

Interpretation

Interpretation

Interpretation

Interpretation

Execution

Ausführung

Code-Transformation, Cross-platform libraries

Page 28: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Approach using m:1:n language translation §  XML as common language for byte code based on Java Bytecode §  Transformation based on XML Stylesheets §  Compatibility libraries used to port apps (even from Android to iOS)

Dr. Thomas Springer 28 Application Development - 9. Cross-Platform Development

XMLVM Translation Approach

Execution phaseBuild phaseImplementation phase

covered by XMLVM

(Xcode: Cross-Compilation to executable code)

Interpretation

Java-Bytecode Java-Platform

.NET-Platform

iOS

Browser

XMLVM-JVM

(XML)

JavaScript-Sourcecode

C/C++-Sourcecode

Interpretation

InterpretationCLI-Bytecode

BCEL

DX

XSL

XSL

MBEL

Interpretation

Cross-Compilation ...

...

Objective-C-Sourcecode

Python- Sourcecode

XMLVM-CLR (XML)

XMLVM-DEX (XML)

Java-Bytecode

Java-Sourcecode

Compilation

Compilation

CLI-Bytecode

XMLVM-CLR, -DFA

(XML)

.NET-Sourcecode(C#, VB, ...)

Ruby(YARV)-Bytecode

Ruby-Sourcecode

Compilation

Ruby

BCEL

XSL

MBEL

BCEL = Byte Code Engineering LibraryMBEL = Microsoft Bytecode Engineering Library

Page 29: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Specific AIR runtime engine + libraries §  GUI declaratively described in MXML (special extensions to

support touch-based interactions) §  GUI description compiled to ActionScript code

Dr. Thomas Springer 29 Application Development - 9. Cross-Platform Development

Adobe Air Interpretation Approach

Execution phaseBuild phaseImplementation phase

ActionScript-Sourcecode

ActionScript-Bytecode

Compilation

Machinecode

...

Interpretation (AIR-runtime need tobe installed)

ExecutionAOT-Compilation

Interpretation (AIR-runtime need tobe installed)

Android, Windows,

Linux, Mac OS

iOS

TV

BlackBerry Tablet OS

Page 30: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Both hybrid and native HTML5 applications (both online and offline) §  JavaScript and Ruby as common code base in one project §  Cross-platform libraries §  Application bundled with lightweight web server + Rhodes Ruby

Framework + Ruby VM

Dr. Thomas Springer 30 Application Development - 9. Cross-Platform Development

Rhodes Mobile Interpretation Approach

Execution PhaseBuild PhaseImplementationPhase

Interpretation (bundled VM)

InterpretationBlackBerry

Compilation

CompilationRuby-

Bytecode

BlackBerry-Bytecode

iOS

Android

WinMobile

Interpretation (Browser-Engine of Platform, WebView)

One Cross-platform Project

Ruby-Source code

HTML-, CSS-, JavaScript-

Source Code

Page 31: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Supports development of client and server side code for Web-Applications in Java

§  Source-to-Source translation to HTML, JavaScript and CSS (High-level Translator)

§  JavaScript Code optimized for various browsers §  Mobile support with specific extensions of GWT libraries

(GWTMobile, GWT-Mobile-Webkit) Dr. Thomas Springer 31 Application Development - 9. Cross-Platform Development

Google Web Toolkit (GWT) Web-based Approach

Execution phaseBuild phase Implementation phase

Java-Source Code (Client)

JavaScript-, HTML-, CSS-Source Code

Interpretation

Interpretation

Browser(Client)

Java-Platform (Servlet

Container / Google App

Engine)

Source-to-Source-Translation

Java-Bytecode

CompilationJava-Source Code (GWT

Servlet)

Page 32: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Phone Gap Hybrid Approach

§  Apache Cordova (formerly PhoneGap) •  Cross-platform tool to create mobile apps based on

HTML, CSS and Javascript •  Combination of Web-based and Translation approach •  Supported platforms: iOS, Android, Windows Phone 7

and 8, BlackBerry OS and bada

•  Approach: o  web content wrapped in PhoneGap App o  Native code to create native browser UI element

(UIWebView (iOS) or WebView (Android)) o  and present locally stored web content Ø Runnable as App Ø Deployment via App Stores possible

Dr. Thomas Springer Application Development - 9. Cross-Platform Development 32

Page 33: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Web-technologies to create UI + logic

§  Cross-platform PhoneGap Javascript API to access device specific features

Ø  Wrapped to native code

§  Often used in combination with Mobile Web Application Frameworks like jQuery Mobile or Sencha Touch

§  Native UI elements not supported

Phone Gap Approach

HTML, CSS, JavaScript

iOS PhoneGap Bib (JavaScript)

iOS PhoneGap Bib (Nativ)

PhoneGap Cross-Platform-API for JavaScript

(Nativer Wrapper Code)

iOS-Plattform-API

Android PhoneGap Bib (JavaScript)

Android PhoneGap Bib (Nativ)

(Nativer Wrapper Code)

Android-Plattform-API

App project for iOS

App projekt forAndroid

Dr. Thomas Springer Application Development - 9. Cross-Platform Development 33

Page 34: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

PhoneGap Development

§  Start: Cross-platform web project §  Compilation with platform-specific IDEs Ø  Web service „PhoneGap build“ for creating Apps

without native IDEs -> build.phonegap.com

34

Xcode  -­‐  iOS

Eclipse  IDE  -­‐AndroidApp  content

HTML,  CSS,  Javascript

Cordova.js

...

cordova.js  Android

cordova.js  iOS

...

Android  App

iOS  App

...

Dr. Thomas Springer Application Development - 9. Cross-Platform Development

Page 35: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

PhoneGap API

§  Cross-platform API provides common interface to access device specific features

Ø  mapped to device OS by Javascript-to-native bridge

35

h"p://phonegap.com/about/feature  

Dr. Thomas Springer Application Development - 9. Cross-Platform Development

Page 36: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Dr. Thomas Springer 36 Application Development - 9. Cross-Platform Development

Appcelerator Titanium Interpretation Approach

§  Goal: „Titanium apps should do more than just run on iOS and Android. When running on an iOS device, your app should feel like an iOS app. Your Android app should feel like an Android app.“

§  "write once, adapt everywhere“ •  Branching to use platform specific features

§  Mapping of Javascript code to precompiled native components accessible via JavaScript APIs

Execution phaseBuild phaseImplementation phase

JavaScript-Quellcode

InterpretationTitanium Symbols

Mapping

Compilation

Android

iOS

BlackBerry(Beta)

Interpretation

Interpretation, JavaScript-to-Native Code Binding

C-Symbols in Maschine-

code

Dalvik-Bytecode

BlackBerry-Bytecode

Execution

bundled with JavaScript-Engine

JavaScriptCore

Mozilla Rhino

JavaScript-Engine of Platform (BrowserField)

Page 37: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Development based on C# for iOS, Android and Windows Phone

§  Builds on Mono (open-source version of the .NET Framework)

§  iOS •  Xamarin’s Ahead-of-Time (AOT) Compiler compiles Xamarin.iOS

applications directly to native ARM assembly code •  MonoTouch runtime (memory allocation, garbage collection,

underlying platform interop, etc.) §  Android

•  Xamarin’s compiler compiles down to Intermediate Language (IL), which is then Just-in-Time (JIT) compiled to native assembly when the application launches

•  IL code bundled with Mono for Android runtime which runs in parallel to Dalvik VM

Dr. Thomas Springer 37 Application Development - 9. Cross-Platform Development

Xamarin Hybrid Approach

Page 38: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Dr. Thomas Springer 38 Application Development - 9. Cross-Platform Development

Xamarin Development

§  App structure according to MVC •  Native UI development in C# based on Xamarin APIs

(MonoTouch.UIKit APIs, Android.Views) •  Cross-platform functionality for business logic and data layer

o  Reusable Code separated into a Core Library

Page 39: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

Comparision

Dr. Thomas Springer 39 Application Development - 9. Cross-Platform Development

Tool Supported Device Platforms Programming Language

Approach App Execution Env.

Generic App parts

Native GUI-Widgets

Supported Platform-Features

webMethods Mobile Designer

Android, Antix Game Player, bada, BlackBerry, BREW, Flash, iOS (iPhone, iPad), JavaME, Nintendo DS / DSi / DSiWare, Sony PSP / PSP Minis, Symbian, webOS, Windows Mobile, Windows Phone 7, Browser (HTML5)

Java (JavaME) Source-to-Source-Translation to C++, Java, C#, ActionScript, JavaScript; Plattform-SDK for Cross-Compilation

native Logic, GUI no

Qt Symbian, Maemo, MeeGo, Windows, Linux, Mac OS

C/C++ Cross-Compilation native Logic, GUI Yes

XMLVM iOS, Android, .NET-Plattform, Java-Plattform, further languages: JavaScript, Python, C++, Objective-C

Java, Ruby, Programming Langugage of .NET-Platform

Bytecode-Compilation native Logic Yes

Adobe AIR iOS (iPhone, iPad), Android, Blackberry Tablet OS, Desktop-PCs, TV

ActionScript, MXML

Bytecode-Interpretation / AOT-Compilation (iOS)

Engine / native

Logic, GUI partly

Kony Android, iOS, J2ME, BlackBerry, Symbian, Windows Mobile, Windows Phone 7, webOS, BREW; Tablets: iOS, Android, BlackBerry, webOS;

Lua Bytecode-Interpretation / Source-to-Source-Translation, Cross-Compilation (iOS)

Engine / native

Logic, GUI yes

Rhodes Android, BlackBerry, iOS (iPhone, iPad), Windows Mobile, Windows Phone 7

Ruby, HTML, CSS, JavaScript

Interpretation of scripting languages Bytecode-Interpretation

Engine, hybrid

Logic, GUI partly

Titanium Mobile

Android, iOS (iPhone, iPad), BlackBerry, Titanium Mobile Web SDK: Browser

JavaScript Interpretation approach Engine Logic, GUI yes

Sencha Touch

iOS (iPhone, iPad), Android, BlackBerry (incl. PlayBook)

JavaScript, (HTML, CSS)

JavaScript-Application-Framework

Web Logic, GUI No

Google Web Toolkit

Any device with Web browser Java Source-to-Source-Translation to HTML, CSS, JavaScript

Web Logic, GUI No

PhoneGap iOS (iPhone, iPad), Android (Smartphones, Tablets), webOS, Symbian, BlackBerry, Windows Phone, bada

Native Code, HTML, CSS, JavaScript

Hybride Approach hybride Logic, GUI no

Page 40: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Strong fragmentation of market for mobile device platforms §  Cross-Platform frameworks try to bridge the gap §  Large number of tools following manifold approaches

•  Methodology •  Target platforms •  Native features •  App anatomy •  User interactions

§  No tool fulfills all requirements §  In sum: instead of „Write once, run everywhere“ it‘s more

„Write once, run many“

à  Possible strategy for projects 1.   Web App to support large set of platforms 2.   Native Apps in addition for most important platforms

Dr. Thomas Springer 40 Application Development - 9. Cross-Platform Development

Summary

Page 41: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Dirk Hering: Analyse von Methoden und Werkzeugumgebungen zur plattformunabhängigen Entwicklung mobiler Applikationen, Diplomarbeit, TU Dresden, 2010

§  Kramer, Dean ; Clark, Tony ; Oussena, Samia: MobDSL: A Domain Specific Language for multiple mobile platform deployment. In: 2010 IEEE International Conference on Networked Embedded Systems for Enterprise Applications (NESEA), 2010, S. 1–7

§  Hamann, Thomas ; Hübsch, Gerald ; Springer, Thomas: A Model-Driven Approach for Developing Adaptive Software Systems. DAIS 2008, Proceedings Bd. 053 (LNCS), pp. 196–209, 2008

§  Kassinen, Otso ; Harjula, Erkki ; Koskela, Timo ; Ylianttila, Mika: Guidelines for the Implementation of Cross-platform Mobile Middleware. In: International Journal of Software Engineering and Its Applications (IJSEIA) 4 (2010), Nr. 3, S. 43–57

§  Calvary, Gaëlle ; Coutaz, Joëlle ; Thevenin, David ; Limbourg, Quentin ; Bouillon, Laurent ; Vanderdonckt, Jean: A Unifying Reference Framework for multi-target user interfaces. In: Interacting with Computers 15 (2003), Nr. 3, S. 289–308

Dr. Thomas Springer 41 Application Development - 9. Cross-Platform Development

References

Page 42: Application Development for Mobile and Ubiquitous …ts2/admuc/lecture1415/9. Cross...Department of Computer Science Institute for System Architecture, Chair for Computer Networks

§  Adobe AIR: http://www.adobe.com/products/air §  Bedrock: http://www.metismo.com §  Google Web Toolkit: http://code.google.com/intl/

de-DE/webtoolkit §  Kony Platform: http://www.kony.com/platform §  PhoneGap: http://phonegap.com/ §  Qt: http://qt.nokia.com/products §  Rhodes: http://rhomoile.com §  Sencha Touch: http://www.sencha.com/products/touch §  Titanium Developer: http://www.appcelerator.com §  XMLVM: http://xmlvm.org

Dr. Thomas Springer 42 Application Development - 9. Cross-Platform Development

References