Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen...

32
Real-Time Computing and Communications Lab., Hanyang University http://rtcc.hanyang.ac.kr Real-Time Computing and Communications Lab., Hanyang University http://rtcc.hanyang.ac.kr Understanding and Writing Tizen v2.3 Applications Minsoo Ryu Real-Time Computing and Communications Lab. Hanyang University [email protected]

Transcript of Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen...

Page 1: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Understanding and Writing Tizen v2.3 Applications

Minsoo Ryu

Real-Time Computing and Communications Lab.Hanyang University

[email protected]

Page 2: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

2Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 2Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Outline

Tizen v2.3 Web Applications Tizen v2.3 Native Applications

Page 3: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

3Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 3Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

TIZEN V2.3 WEB APPLICATIONS

Page 4: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

4Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 4Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Tizen v2.3 Architecture Overview

Page 5: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

5Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 5Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Web Applications and Web APIs

Web Applications Using Web based technologies Allowed to access local device and platform resources

Web APIs W3C/HTML5 and de-facto Supplementary APIs

• Widget Spec: Widget P&C, Widget Interface, Widget URI, …• HTML5 & CSS3: Video/Audio, Web Storage, Web Workers, HTML5

Forms, …• W3C Device APIs: Battery Status, Network Info, Vibration, …• Supplementary APIs: WebGL, viewport Meta Tag, Type Array

Tizen Web Device APIs Tizen Web UI FW

Page 6: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

6Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 6Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Web Application Packaging

Packaging W3C Widget Packaging and Configuration An example of an app structure (right)

Config.xml Web App Configurations Application basic info (ID, icon, name, …) Localization Preferences Feature Privilege

Page 7: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

7Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 7Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Web APIs

Standard HTML5 + Tizen Device AP Apps need access to device features outside of the HTML Tizen web apps can access various device features via Web

Device API Enabling web apps to work like native apps with minimum porting

effort

Page 8: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

8Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 8Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Tizen Mobile Web Device APIs Categories

API Description Version (Since) Mobile Supported on

Mobile Emulator

Tizen CommonTizen The base object for accessing the Tizen Web Device API. 1.0 Mandatory Yes

ApplicationAlarm This API provides functionality for setting and unsetting alarms. 1.0 Mandatory Yes

Application This API provides information about running and installed applications and controls them. 1.0 Mandatory Yes

Data Control This API provides interfaces and methods for accessing specific data exported by other applications. 2.1 Mandatory Yes

Package This API provides information install/uninstall package and get information about installed packages. 2.1 Mandatory Yes

CommunicationBluetooth This API enables control over Bluetooth. 1.0 Optional No

Messaging This API allows SMS, MMS, and Email message sending and receiving. 1.0 Optional YesOnly e-mail

Network Bearer Selection

This API provides interfaces and methods for users to set network bearer for a specific IP address. 2.1 Optional No

NFC This API allows access to NFC device(s). 1.0 Optional No

Push This API provides the functionality for receiving push notifications. 2.1 Optional Yes

Secure Element This API provides interfaces and methods for access to Secure Elements. 2.1 Optional No

Page 9: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

9Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 9Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Tizen Mobile Web Device APIs Categories

API Description Version (Since) Mobile Supported on

Mobile Emulator

Content

Content This API provides functionality to discover multimedia content (such as images, videos or music). 2.0 Mandatory Yes

Download This API provides interfaces and methods for downloading remote objects by HTTP request. 2.0 Mandatory Yes

Exif This API provides interfaces and methods for manipulating Exif data from JPEG file. 2.3 Mandatory Yes

Input/Output

Archive This API provides interfaces and methods to create an archive file as well as various other kinds of manipulation(e.g. extract files, add a file to an archive file). 2.3 Mandatory Yes

FilesystemThis API provides access to the file system of a device. This API might be obsolete in the future when W3C File APIs are extended to access system-sensitive files by Web applications.

1.0 Mandatory Yes

Message Port This API provides the functionality for communication with other applications. 2.1 Mandatory Yes

Multimedia

Media Key This API provides a way to get notified when a media key has been pressed or released. 2.3 Optional No

Sound This API provides a way to control sound volume level. 2.3 Mandatory Yes

Page 10: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

10Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 10Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Tizen Mobile Web Device APIs CategoriesAPI Description Version

(Since) Mobile Supported on Mobile Emulator

Social

Account This API provides interfaces and methods for managing accounts(e.g. create an account, change the account information). 2.3 Mandatory Yes

Bookmark This API provides interfaces and methods for access to Bookmarks. 2.1 Mandatory Yes

Calendar This API enables the management of calendar information. 1.0 Mandatory Yes

Call History This API allows accessing call history for cellular and VoIP calls. 2.0 Optional No

Contact This API enables the management of contact information. 1.0 Mandatory Yes

Data Synchronization

This API provides methods to synchronize device data to the server using the OMA DS 1.2 protocol. 2.1 Optional No

SystemFM Radio This API provides interfaces and methods for listening to FM radio. 2.3 Optional Yes

Human Activity Monitor

This API provides interfaces and methods for retrieving human activity data from the various sensors on the device. 2.3 Optional YesOnly HRM

Power This API provides interfaces and methods for controlling power resources. 2.0 Mandatory Yes

Sensor This API provides interfaces and methods for getting sensor data from the various sensors on the device. 2.3 Optional Yes

System Information

This API provides information about the device's display, network, storage and other capabilities. 1.0 Mandatory Yes

System Setting This API provides system setting functionality. 2.0 Mandatory Yes

Time This API exposes information about date, time and time zones. 1.0 Mandatory Yes

Web Setting This API manages the setting states of the web view in web applications. 2.2 Mandatory Yes

Page 11: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

11Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 11Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Web Device API Privileges

API Privilege for higher security Privilege level: apps need to have a same or higher privilege level

than the API required (Public < Partner < Platform) API Privileges need to be described in config.xml

Page 12: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

12Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 12Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Typical Web App Directory Structure

Page 13: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

13Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 13Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

LAB: WRITING A TIZEN V2.3 WEB APPLICATION THAT RETRIEVES

SYSTEM INFO

Page 14: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

14Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 14Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Writing an Example Web App

Create an application project

1. In the IDE, select File -> New -> Tizen Web Project 2. Select the project type

• Web UI Framework -> Single Page Application 3. Name your project 4. Click Finish

Page 15: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

15Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 15Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Writing an Example Web App

After creating an application project, You will get several template files including config.xml,

icon.png, etc.

Among them, you need to modify the following two files index.html main.js

Page 16: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

16Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 16Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Writing an Example Web App

Modify the “index.html”

Make a list of devices

This function is defined in “main.js”

Page 17: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

17Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 17Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Writing an Example Web App

Modify the “main.js”

Page 18: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

18Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 18Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Writing an Example Web App

Modify the “main.js”

When the button is checked, then the function that registered in this part is called, if the device exists

Page 19: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

19Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 19Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Writing an Example Web App

Modify the “main.js”

Page 20: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

20Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 20Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Writing an Example Web App

Search all connected devices

$ sdb devices

Page 21: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

21Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 21Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Writing an Example Web App

Start running in the RD-PQ device

Page 22: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

22Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 22Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Writing an Example Web App

Snapshots of the example Web app

Page 23: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

23Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 23Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

TIZEN V2.3 NATIVE APPLICATIONS

Page 24: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

24Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 24Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Tizen v2.3 Architecture Overview

Page 25: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

25Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 25Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

LAB: WRITING A TIZEN V2.3 NATIVE APPLICATION THAT TURNS ON

FLASH LIGHT

Page 26: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

26Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 26Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Example Tizen v2.3 Native Application

• Native Application in Tizen

Make a list and Naviframe

Page 27: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

27Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 27Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Example Tizen v2.3 Native Application

• Native Application in Tizen

Call flash_cb function, when “Flash” is selected

Page 28: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

28Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 28Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Example Tizen v2.3 Native Application

• Native Application in Tizen

Page 29: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

29Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 29Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Example Tizen v2.3 Native Application

• Native Application in Tizen

Make a label

Make a toggle switch and show the object

Page 30: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

30Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 30Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Example Tizen v2.3 Native Application

• Native Application in Tizen

Page 31: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

31Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 31Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Example Tizen v2.3 Native Application

• Native Application in Tizen

These APIs are defined in “device/led.h”

Page 32: Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen v2.3 Applications Minsoo Ryu ... MMS, and Email message se nding and receiving.

32Real-Time Computing and Communications Lab., Hanyang University

http://rtcc.hanyang.ac.kr 32Real-Time Computing and Communications Lab., Hanyang Universityhttp://rtcc.hanyang.ac.kr

Example Tizen v2.3 Native Application

• Snapshots of the example native app

Click Flash ON