An Introduction to Tizen 2.3 Application Architecture

Tizen’s architecture is designed to be equally friendly to web developers and embedded systems developers alike, and its flexible nature encourages its use on an array of devices including TV’s, smart phones, watches, tablets, In-Vehicle Infotainment, and smart appliances. It does this by providing a Web API that allows app developers to create simple programs using only HTML/CSS/JavaScript, and also a Native API that provides the benefits of building software for embedded systems in C and C++. The current version of Tizen being used in consumer products is 2.3, and this is the version you will most likely want to target if you are an app developer.

This article will cover how Tizen applications are setup and how the Tizen Native and Web APIs work.

Tizen Application Types

There are three primary types of apps that can be built in Tizen:

Native Application – Applications that are developed similar to traditional Linux applications using C or C++ (though implementation is fairly different) and can access more advanced device-specific features like the camera, GPS, and accelerometer in addition to more advanced system settings and functionality.

Web Application – Web apps are essentially a website stored on your device that are built using web-native languages like HTML/CSS and JavaScript. They use the Tizen Web Framework to interact with the native subsystems and the Linux Kernel. Web apps are far more simple than native apps, however they are also more limited in their functionality.

Hybrid Application – Applications that use both the Native and the Web APIs offered by Tizen.

Tizen Application Architecture

Tizen Profiles

Tizen is being built to work on a wide variety of platforms with a focus on embedded devices. In order to accommodate the various types of devices, a set of profiles have been defined to make it easier to develop applications for specific purposes. In the 2.3 SDK, there are two profile types you can choose from: Mobile and Wearable. The mobile profile is designed for devices like smart phones and tablets and the wearable profile is designed for devices like smart watches.

While both currently support the Tizen Web API, only the mobile profile supports the Native API. This will change once the version 2.3.1 of the wearable API is released which will include support for Native APIs. For the time being, this means if you want to develop a native or hybrid application, you will need to use the mobile profile when creating your new project.

Web API

A standard web application project structure with basic elements.

The Web API is designed to allow developers to easily build applications using web native languages like HTML/CSS, and JavaScript. It is not as full-featured as the Native API, but it makes it much easier to design simpler apps.

A program built using the web API is laid out much like a standard website with an index.html file that serves as the root, and separate directories for resources like JavaScript, CSS, images, sound resources, and other items. This makes it extremely intuitive for developers with a background in web development, and makes it easy to quickly write simple applications using high-level languages. The trade off here is that the Web API is, of course, not as full-featured or as efficient as the Native API.

Native API

The Native API provides all of the memory management and performance benefits that come with building applications for Linux in C and C++. If you are looking to add features that are not provided by the web API, the Native API should be able to help you as it includes dozens of API modules that cover a large range of capabilities. This API provides numerous interfaces to much of the hardware that is found in modern mobile and wearable devices, and does so in an environment that is tailored for limited resources.

Apps that use the Native API rely on a series of lifecycle events in order to operate; these events put the app in various states that enable certain controls or operations.

Ready – The app is registered with the framework and initializes callbacks to receive notifications from the application framework.

Created – The resources needed for handling the lifecycle framework are completed (UI initialization, setup of database, etc). In this stage, the app is ready for the main loop to be run.

Running – The main loop (the app) is performing its tasks, and interacting with the user. In this state, it constantly checks timers, events, and other services, but only consumes CPU when there is work to be done.

Paused – The app moves to the background and will perform only essential tasks. In this state, the app releases resources to be used by others. This state is only needed for apps that have a UI.

Terminated – The application is closed.

Applications can be moved between the paused and running state as needed. For example, external events like an incoming phone call can force an app to move to a paused state in order to free resources for the phone call events. These lifecycle events are what give the Native API more efficient resource usage when compared to the Web API.

The Tizen Native Application Lifecycle

Hybrid Applications

Hybrid apps are able to leverage the benefits of both the Web and Native APIs to allow developers to code as much as they can using the simpler web frameworks and rely on the Native API only when better efficiency or more complicated functionality is needed. For these apps, the Web API is used to create things like the user interface or a front-end to a web service, and to handle basic user interactions. The Native API is limited to services only, meaning you can’t use it to build the UI, but rather it is used to extend the functionality into more advanced areas like gesture recognition, location information, network connections, and security. Setting one up is as simple as setting up a project reference in a web app that points to the related native app.

Bringing it All Together

This article should make it clear why Tizen can be a great platform to develop applications for, and should provide some insight into how a Tizen app should be structured. If you want to learn any more about the information shared in this article, a good starting point is the Tizen Developer Documentation. I will be posting a follow up to this article soon that dives more deeply into what the Native and Web APIs offer and covers what you need to consider when deciding how to use them.

Share this:

Author: Ben Lloyd Pearson

Ben is an open source technologist experienced in a wide array of modern IT tools. He's done a bit of everything, from web development, to systems administration, web publishing, and beyond.
View all posts by Ben Lloyd Pearson