Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen...
Transcript of Understanding and Writing Tizen v2.3 ApplicationsTizen_2.3).pdf · Understanding and Writing Tizen...
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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”
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”
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
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”
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
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
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
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
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
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
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
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
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
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
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
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”
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