Upload
job-andrews
View
226
Download
2
Embed Size (px)
Citation preview
Embedded Software Lab. @ SKKU
29
3
• Web application– Using web based technologies (HTML/JS/CSS/etc.)– Accessing local device / platform resources– Can be installed on the device
• Web Runtime– Package management (installation, update, etc.)– Execution and lifecycle (launching, pause, resume, etc.)– Runtime security (API/network access, sandboxing, etc.)– Device and platform integration
What is Web app and Web Runtime
Embedded Software Lab. @ SKKU
29
5
• Environment within which all web applications run on Tizen• To access local device and platform resources
Web Runtime on Tizen v2.3
Embedded Software Lab. @ SKKU
29
7
• Describes the web application itself• Follows W3C widget Spec, and
Tizen-specific features• <name> : application name• <widget version=“x.y.z”> attribute• <content
src=“start_file_name.html”/>• <icon src=“icon_file_name.png” />• <author>• <feature>: Each feature has a
corresponding URL from which you can obtain more information about the feature
config.xml• <tizen:privilege> element. List any
privileges application requires• <tizen:application id=“…”> attribute.
Unique application identifier• <tizen:application required_version=“”>
attribute. The minimum required platform on which the application can run
• <tizen:app-control> To make use of certain functionality provided by another application
• <tizen:app-widget> Show some dynamically updated content from another application directly on the home screen
Embedded Software Lab. @ SKKU
29
8
• Based on open-source javascript libraries– Such as jQueryMobile, jQuery, Globalize
• Provide a large set of widgets that have the same look and feel
Tizen Web UI framework
Embedded Software Lab. @ SKKU
29
9
• Overview– Touch-optimized JavaScript framework for developing mobile web
application– Includes optimized functions such as UI controls, event handler,
animation effects, and Ajax communication– Consists of HTML, CSS, JavaScript– HTML5-based user interface system designed to make responsive web
sites and apps– data-* attributes: data-role, data-theme, data-position, data-transition,
data-icon • Supported platforms
– Apple iOS, Android, Windows Phone, Blackberry, Palm WebOS, Firefox Mobile, Chrome for Android, Skyfire, Opera Mobile, Meego, Tizen, Samsung Bada, Kindle, …
• Downloads– From jquerymobile.com or using jQuery Mobile CDN (Contents Delivery
Network)• Comparison with Sencha Touch
– Superior in terms of portability, performance, entry barrier, and library size
jQuery Mobile
Embedded Software Lab. @ SKKU
29
10jQuery Mobile (example)
jQuery Mobile libraryjQuery library
jQuery Mobile stylesheets
Embedded Software Lab. @ SKKU
29
11
• designing and developing applications that function for multiple cultures
• jQuery.glob.all.js includes around 350 cultures (date, number, currency)
Globalization
Embedded Software Lab. @ SKKU
29
13
• UI applications– Which have a graphical user interface– Only one of them can be in the foreground at a time
• Service applications– Which do not have a graphical user interface (background)– Displayed by Task switcher (which provides the list of all running
applications), but no event occurs if the user selects– Useful in performing activities that need to run periodically or
continuously, but do not require any user intervention
Native Application
Embedded Software Lab. @ SKKU
29
14
• Multitasking in Tizen– Supported but only one Tizen UI application can run in the
foreground while the remaining applications run in the background
– Determine which UI application is running on the foreground• Using the task switcher• Using main menu icons
– Termination when the End key or the system memory is low• Out of Memory Policy
– low-memory killer will zap background applications in least-recently-used order until memory pressure has been relieved.
• Multitasking priority level
Native Application Model
Low Background UI applications
Service applications
Background media players
Foreground UI application
Foreground media player
Application launcher
High Voice or video call, or other system applications
Embedded Software Lab. @ SKKU
29
15
• Handling System Events– Battery Events
• Check the battery level of the device using OnBatteryLevelChanged() or OnBatteryLevelChangedInPercentage() event handler
• Ex) EMPTY; terminate the application, CRITICAL; stop using multimedia features
– Memory Events• Free unused memory form the heap using the OnLowMemory() event
handler
– Screen Events (applicable only to UI applications)• When the OnScreenOff(), reduce power consumption by releasing the
activated resources (such as 3D, media, and sensors) which are no longer used to enter the sleep mode
– Checkpoint Events• To avoid losing data due to unexpected termination, save the application
state or context to the application registry or to the device storage using OnAppChechpointing() event handler
Native Application Model
Embedded Software Lab. @ SKKU
29
16
• A frame is created by UI application, initialized with app_create_cb()
• After the application is initialized, it can handle events and its state is set to running
• The application gets to release its resources when the app_terminate_cb() event handler is called
Life Cycle of Native Applications
Embedded Software Lab. @ SKKU
29
17
• Launching– UI app; from the main menu, task switcher, a running application or
when a registered condition is met– Service app; from another application
• When starts, – Process Manager loads the necessary libraries and executable binary
into the memory– Instance of the application is created, executed in main()
• Initializing, previous application states are loaded, ui_app_main()
Launching Application
Embedded Software Lab. @ SKKU
29
18
• When,– Tizen native application itself calls the Terminate()– The system forced the application to shut down
• Memory or battery power is extremely low
– Handled in the app_terminate_cb()• Free its resources and terminates• Allocated UI controls, such as the form and its child controls are also
released• save the application's states into application registry
• urgent termination– triggered by the power-off and OOM– this method is not likely to be called, so the application should save the
critical data as often as possible. (check point or callback for low memory)
• normal termination– triggered by self or other applications– this method is executed properly (more time but limit of 3-5 seconds)
Terminating Application
Embedded Software Lab. @ SKKU
29
19Application State Transition
Paused•Application is not visible for the user
Running•While the UI app is running, it can switch between the background and foreground•During the switch, the window state of the app changes •The service app always runs in the background
Initializing•App framework initializes the application•The app data saved on the previous run is restored•For UI app, the app's frame must be created and added explicitly in app_create_cb()
Terminated•App framework removes the app from memory
Embedded Software Lab. @ SKKU
29
20
• full-screen Tizen::Ui::Controls::Frame container that creates the top-level window– There must be at least one frame per application
• The form in turn contains the indicator bar, header, footer, and UI controls– There can be multiple forms per application
Tizen User Interface
Embedded Software Lab. @ SKKU
29
21
• One frame in a UI application which is the top-level main window• The frame has three states
Frame State Transition
State: MinimizedStatus: Invisible, Graphic / media processing and sensor manipulations are discontinuedTriggered by:1. HOME key is pressed2. Another UI application has been launched
State: Deactivated Status: No input to deactivated frame, partially shownTriggered by:1. Another frame is located on top of the current frame2. Another window, such as an incoming call, pop-up, or alarm is displayed
State: Activated Status: Fully visible, receive inputTriggered by:1. User selects the application on task switcher2. User presses the main menu icon3. A window that had caused the application to become deactivated is terminated
Embedded Software Lab. @ SKKU
29
22
• Register application with specific launch conditions– When the launch conditions are met, the registered application is
launched automatically
• Registration– At runtime, AppManager::RegisterAppLaunch() method with privilege
• http://tizen.org/privilege/application.launch
– At application installation, by specifying the condition in the manifest file
Registering a Launch Condition
Type Condition format Description
Due time
L"DateTime='mm/dd/yyyy hh:mm:ss'"
Launch at the wall time, 'mm/dd/yyyy hh:mm:ss'.
Period L"DueTime='mm/dd/yyyy hh:mm:ss'LaunchPeriod='mm'"
Launch at the wall time, 'mm/dd/yyyy hh:mm:ss', and every 'mm' minutes. The launch period must be between 60 minutes and 10 years.
Serial L"Serial='keyword'" Launch when receiving 'keyword' as serial communication input.
NFC L"NFC='command'" Launch when receiving 'command' as Near Field Communication (NFC) tag with NFC Data Exchange Format (NDEF) data.
Embedded Software Lab. @ SKKU
29
23
• Tizen::Io::MessagePortManager class– All Tizen native applications can communicate with each other using a
MessagePort – The message data type is a map data which consists of a key and value
pair (Tizen::Base::String)
• 2 types of message ports– The Tizen::Io::LocalMessagePort class
• To receive messages from the another application, set the Tizen::Io::IMessagePortListener interface from the local message port.
– The Tizen::Io::RemoteMessagePort class• To send messages to other applications• The local message port information can be sent to the other application for
bi-directional communication
Message Port
Embedded Software Lab. @ SKKU
29
24
• SendMessage()– send messages to another application
• OnMessageReceivedN()– Another application can receive the messages
Uni-directional Communication
Embedded Software Lab. @ SKKU
29
25
• In the server application,– Tizen::Io::LocalMessagePort::RequestLocalMessagePort()
• Requests a LocalMessagePort instance with the specified message port name
– AddMessagePortListener()• Receive message from the client application
– OnMessageReceivedN()• Handle the received messages from the client application
• In the client application,– Tizen::Io::LocalMessagePort::RequestRemoteMessagePort()
• Retrieve the RemoteMessagePort instance with specified remote application ID and message port name
– SendMessage()• Send messages from the client application to the server application
Uni-directional Communication
Embedded Software Lab. @ SKKU
29
26
• SendMessage()– Send messages and local message port information to another
application– This local message port information can be used to send the response
messages from the other application which receives these messages
• OnMessageReceivedN()– Receive the messages– The remote message port information can be used to send response
messages to the application which sends the messages
Bi-directional Communication
Embedded Software Lab. @ SKKU
29
27
• In the server application,– Tizen::Io::LocalMessagePort::RequestLocalMessagePort()
• Requests a LocalMessagePort instance with the specified message port name
– AddMessagePortListener()• Receive message from the client application
– OnMessageReceivedN()• Handle the received messages from the client application• Respond back using the RemoteMessagePort instance received
from the client application
• In the client application,– RequestRemoteMessagePort() / RequestLocalMessagePort()
• Retrieve the RemoteMessagePort/LocalMessagePort instance with specified remote application ID and message port name / just message port name
– SendMessage()• Send messages from the client application to the server application
– OnMessageReceivedN()• Handle the received messages from the server application
Bi-directional Communication
Embedded Software Lab. @ SKKU
29
28
• Application controls and data controls– Create the author certificated and register the created
certificate to IDE• Execute certificate-generator.sh or certificate-generator.bat with shell• Output is pkcs12 file
– Give permission by application certificate in the manifest editor• Other applications with which have the same permission can access the
exported functionality of the application
• Message port communication– RequestTrustdLocalMessagePort(),
RequestTrustedRemoteMessagePort()• Get the trusted message port instance• Only if both applications are signed with a certificate that is uniquely
assigned to its developer
Trusted Communication