Development Techniques for Native/Hybrid Tizen Apps. Presented by Kirill Kruchinkin



Similar documents
Development Techniques for Native/Hybrid Tizen Apps. Presenter Matti Pakarinen

Tizen Web Runtime Update. Ming Jin Samsung Electronics

Getting Started with Tizen SDK : How to develop a Web app. Hong Gyungpyo 洪 競 杓 Samsung Electronics Co., Ltd

Professional Tizen Application Development

HYBRID APPLICATION DEVELOPMENT IN PHONEGAP USING UI TOOLKITS

Extending Tizen Native Framework with Node.js

Cross-Platform Tools

Mobility Introduction Android. Duration 16 Working days Start Date 1 st Oct 2013

Bridging the Gap: from a Web App to a Mobile Device App

Porting Existing PhoneGap Apps to Tizen OS - Development Story

Smartphone Application Development using HTML5-based Cross- Platform Framework

SYST35300 Hybrid Mobile Application Development

Making Web Application using Tizen Web UI Framework. Koeun Choi

DEVELOPING NFC APPS for BLACKBERRY

Here to take you beyond Mobile Application development using Android Course details

JavaFX Session Agenda

Crosswalk: build world class hybrid mobile apps

ANDROID PROGRAMMING - INTRODUCTION. Roberto Beraldi

General principles and architecture of Adlib and Adlib API. Petra Otten Manager Customer Support

Lecture 1 Introduction to Android

Developing Native JavaScript Mobile Apps Using Apache Cordova. Hazem Saleh

Enabling Cordova (aka PhoneGap) on Tizen. René Pourtier / Luc Yriarte

Specialized Android APP Development Program with Java (SAADPJ) Duration 2 months

QML and JavaScript for Native App Development

Retool your HTML/JavaScript to go Mobile

Mobile Application Development

Programming in HTML5 with JavaScript and CSS3

Enable Your Automated Web App Testing by WebDriver. Yugang Fan Intel

Introduction to Tizen SDK Alpha. Taiho Choi Samsung Electronics

Leveraging Tizen IVI Platform for Realizing V2X Use Cases

Example of Standard API

Mobility Information Series

Development for Mobile Devices Tools from Intel, Platform of Your Choice!

ODROID Multithreading in Android

Developer's Cookbook. Building Applications with. The Android. the Android SDK. A Addison-Wesley. James Steele Nelson To

BogDan Vatra and Andy Gryc. Qt on Android: Is it right for you?

Take full advantage of IBM s IDEs for end- to- end mobile development

How To Develop A Mobile App With Phonegap

HTML5: Separating Fact and Fiction. #wipjam

XML Processing and Web Services. Chapter 17

HTML5 Applications Made Easy on Tizen IVI. Brian Jones / Jimmy Huang

Publishing to TIZEN Using the Automated Conversion/Repackaging of Existing Android Apps. Hyeokgon Ryu, Infraware Technology, Ltd.

Native, Hybrid or Mobile Web Application Development

MA-WA1920: Enterprise iphone and ipad Programming

Cross Platform App Development

QL Integration into Scala and Excel. Martin Dietrich

Introduction to Oracle Mobile Application Framework Raghu Srinivasan, Director Development Mobile and Cloud Development Tools Oracle

UNIVERSITY AUTHORISED EDUCATION PARTNER (WDP)

WebRTC: Why and How? FRAFOS GmbH. FRAFOS GmbH Windscheidstr. 18 Ahoi Berlin Germany

Making the Most of Existing Public Web Development Frameworks WEB04

Whitepaper. Trans. for Mobile

Overview. The Android operating system is like a cake consisting of various layers.

Tizen Technical Overview 枪 晦 随 鬴 缃 拜 枋 幞 垖 幁 穧 幤

Android Basics. Xin Yang

FRAFOS GmbH Windscheidstr. 18 Ahoi Berlin Germany

Cross-Platform Software Considerations for Internet of Things

Android Development. Marc Mc Loughlin

Android Architecture. Alexandra Harrison & Jake Saxton

Building native mobile apps for Digital Factory

WEB, HYBRID, NATIVE EXPLAINED CRAIG ISAKSON. June 2013 MOBILE ENGINEERING LEAD / SOFTWARE ENGINEER

An Introduction to Android Application Development. Serdar Akın, Haluk Tüfekçi

Building A Self-Hosted WebRTC Project

Introduction to Android

... Introduction Acknowledgments... 19

Step into the Future: HTML5 and its Impact on SSL VPNs

ANDROID INTRODUCTION TO ANDROID

Issues of Hybrid Mobile Application Development with PhoneGap: a Case Study of Insurance Mobile Application

Multi-Platform Mobile Application Development Analysis. Lisandro Delía Nicolás Galdámez Pablo Thomas Leonardo Corbalán Patricia Pesado

ITG Software Engineering

HTML5 the new. standard for Interactive Web

WebSocket Server. To understand the Wakanda Server side WebSocket support, it is important to identify the different parts and how they interact:

An introduction to creating Web 2.0 applications in Rational Application Developer Version 8.0

Lecture 4 Cross-Platform Development. <lecturer, date>

WebLogic & Coherence. Best backend for Mobile Apps. July 2014 INSERT PRESENTER TITLE AND DATE

Overview of CS 282 & Android

Dave Haseman, Ross. Hightower. Mobile Development for SAP* ^>. Galileo Press. Bonn. Boston

Tizen Architecture. Sunil Saxena, Intel Hobum (Vincent) Kwon, Samsung

AUTOMATED CONFERENCE CD-ROM BUILDER AN OPEN SOURCE APPROACH Stefan Karastanev

An Introduction to Android

How To Develop Android On Your Computer Or Tablet Or Phone

Best practices building multi-platform apps. John Hasthorpe & Josh Venman

Parallel Web Programming

Appium mobile test automation

Load and Performance Load Testing. RadView Software October

Tizen Compliance Test (TCT) Hojun Jaygarl (Samsung Electronics), Cathy Shen (Intel)

Table of Contents. Adding Build Targets to the SDK 8 The Android Developer Tools (ADT) Plug-in for Eclipse 9

SimWebLink.NET Remote Control and Monitoring in the Simulink

HTML5 AUTOMOTIVE 2013 White Paper Series

ANDROID APP DEVELOPMENT: AN INTRODUCTION CSCI /19/14 HANNAH MILLER

BELATRIX SOFTWARE. Why you should be moving to mobile Cross Platform Development? Introduction

Enterpise Mobility Lexicon & Terminology

CommonTime Making Business Mobile. Enterprise. CommonTime. Mobile Solutions. mdesign Platform.

Технологии Java. Android: Введение. Кузнецов Андрей Николаевич. Санкт-Петербургский Государственный Политехнический Университет

<Insert Picture Here> Java, the language for the future

Transcription:

Development Techniques for Native/Hybrid Tizen Apps Presented by Kirill Kruchinkin

Agenda Introduction and Definitions Practices Case Studies 2

Introduction & Definitions

2 App Types Browser Apps Installable Apps Native WebApps Hybrid 4

Browser Apps One platform for many devices HTML5 is everywhere HTML5 is mobile HTML5 is skillful HTML5 is open 5

Tizen Application Level Web Applications Native Applications Web Framework Native Framework W3C / HTML5 Device APIs Social / Content Locations Uix Media Web / Xml Video CSS3 Touch WebGL BT NFC Call MSG Net / Telephony / Messaging Graphics / UI Worker Web Runtime Base / Io / Text / Locales App / Security / System Services Core App Framework Graphics / UI Multimedia Location Messaging Web Security System Base Connectivity Telephony PIM Linux Kernel and Device Drivers 6

Web Apps Advantages of Browser Apps with HTML5 Full offline support Device APIs Native UI Browser Websites W3C Standard JS API Webkit W3C Standard JS API Webkit Tizen Web Application Web Runtime Tizen Device API Plugins Native Platform 7

Native Apps Broader access to device hardware Better integration with system features Faster, smoother and better UI 8

Hybrid Apps Web UI and Native Services Rapid development of UI Data processing in background Share native services between applications Native open-source libraries 9

Always a Challenging Decision Native Web Hybrid Rapid UI development - + + Open standards based - + + Performance in heavy calculation + - + Works offline + + + Background support + - + Deep HW/platform integration + - + Low complexity - + - 10

Practices

Steps to a Hybrid App Create a web application project Create a native service project Define the reference in the project s properties Define a bridge between the web and service applications Build the application Install the application 12

Bridging Native and JS Messaging layer between web and native Message Port Websocket JavaScriptBridge plugin 13

App Communication through Message Ports Implements a communication between two applications Platform built-in 14

Message Porting: Web Step 1 Define message handler and create a local message port function onreceive(data, remotemsgport) { console.log('received data to \'' + remotemsgport.name + '\''); // Search value with the "response key for(var i in data) { if(data[i].key == "response") { response = data[i].value; break; } } } try { localmessageport = tizen.messageport.requestlocalmessageport(localmessageportname); localmessageportwatchid = localmessageport.addmessageportlistener(function(data, remote) { onreceive(data, remote); } ); } catch (e) { console.log("request local message port Error"); } 15

Message Porting: Web Step 2 Launch service application function onsuccess() { console.log("service App launched successfully!"); } function onerror(err) { console.log("service Applaunch failed ="+ err); } try { tizen.application.launch(appid, onsuccess, onerror); } catch (e) { // handle error } 16

Message Porting: Web Step 3 Open remote port try { remotemessageport = tizen.messageport.requestremotemessageport(appid, serviceportname); } catch (e) { console.log("request remote message port Error "); } 17

Message Porting: Native Step 1 void ServiceChannel::OnMessageReceivedN(RemoteMessagePort* premotemessageport, IMap* pmessage) { String *pdata = static_cast<string *>(pmessage->getvalue(string(l"command"))); if (pdata!= null) { Define local port listener } IJsonValue* pjson = getjsonobj(pdata); if(null!= pjson) { // Extract command from pjson in to the pcommand pointer... if(null!= pcommand) { if (pcommand->equals(do_command_1, true)) { // extract additional parameters from pjson and perform requested operation it is would be better to schedule this operation and // execute it asynchronously (for example, send event to application, set timer, run thread etc,..) } } // Relase pjsonobject... } // Prepare answer in str variable... //Send response in case of bi-direction communication HashMap *pmap = new HashMap(SingleObjectDeleter); pmap->construct(); pmap->add(new String(L"response"), new String(str)); premotemessageport->sendmessage(mlocalmessageport, pmap); // deallocate resources... 18

Message Porting: Native Step 2 Create local port mlocalmessageport = MessagePortManager::RequestLocalMessagePort(mLocalPortName); mlocalmessageport->addmessageportlistener( messageportlistenerimplementation ); 19

Message Porting: Native Step 3 Create remote port mremotemessageport = MessagePortManager::RequestRemoteMessagePort(mRemoteAppID, mremoteportname); 20

Websocket Approach Works in other platforms Works asynchronously Doesn t have a payload limit Handshake implementation RFC 6455 21

Javascriptbridge Plugin Include the JavaScriptBridge plugin in a Web page Implement a JS method to be called from native Implement Tizen::Web::Controls::IJavaScriptBridge on native sode 22

23 Debugging

24 Debugging Video

25 3 rd Party lib Static Linking

3 rd Party lib Dynamic Linking //get a lib Path wchar_t const * const LIB_NAME = L"lib/libHybridServiceLib.so"; Tizen::App::App *pxapp = Tizen::App::App::GetInstance(); String libpath = pxapp-> GetAppRootPath(); libpath.append(lib_name); //get initialized instance of Library Tizen::Base::Runtime::Library library; result r = library.construct(libpath); //get a function pointer void *pmethod = library.getprocaddress(l"calculatemd5"); pcalculatehash = reinterpret_cast<char* (*)(byte const *, int)>(pmethod); //use the function pcalculatehash(pbytearray, bytearraylength); 26

JSON JavaScript Object Notation (JSON) is a text-based open standard designed for human-readable data interchange Parsers are available for JavaScript (native JS, jquery and other frameworks) and a native API Human-readable format that is easy for debug Web services provide data in JSON format Key-value data format is enough to present any data that is required in JavaScript 27

JSON Usage Web // parse var jsondata = JSON.parse(strJSON); // compose var strjson = JSON.stringify(jsonData) Native Tizen::Web::Json::JsonParser for parsing Tizen::Web::Json::JsonWriter for composing 28

3 rd Party frameworks Cordova Appcelerator Titanium Cocos2d-html5 29

Tips & Tricks Use Message Ports as a bridge Implement re-try logic to open Message Ports Use JSON to transfer data Widely use Resource Acquisition Is Initialization (RAII) idiom Share assets and layouts between multiple apps in your package Specify all privileges needed for the app in the manifest of the main project 30

Case Studies

TuneIn TuneIn offers the user the ability to listen to streaming audio from thousands of radio stations It is a Hybrid App to support more audio formats and resolve stream handling Web App UI part TuneIn server communication Native Service audio playing playlist downloading 32

33 TuneIn Video

Peeking Protector: native experience A face recognition application that restricts access to a whole device or selected applications unless the owner s face is recognized. The application is fully native because the app should: intercept launching other protecting apps have the top-most visibility hook hard keys like Home and Power utilize native built-in face recognition API use multi-threading to be responsive while the face recognition piece is in progress 34

35 Peeking Protector Video