Download as pdf or txt
Download as pdf or txt
You are on page 1of 55

CASEmobile

71

NOVI PRISTUPI I MOGUNOSTI U KITKAT ANDROID 4.4 API-JU


NEW APPROACHES AND POSSIBILITIES IN ANDROID 4.4 KITKAT API
Zoran Kos, Zlatko Stapi

SAETAK
Android OS je danas jedan od najrasprostranjenijih OS-a na novoisporuenim mobilnim i tablet ureajima. Razlog zbog
kojeg postoji interes za pisanjem o ovoj temi nije samo u tome to sve vie ljudi zamjenjuje rad na raunalima i laptopima
za rad na mobilnim ureajima i tabletima, ve to su u najnovijoj verziji Android OS-a implementirana inovativna i svjea
rjeenja koja korisniku omoguuju jednostavniji i bri rad, utedu energije, utedu vremena i manje uloenog novca. Rad
prikazuje nove pristupe i mogunosti trenutno najnovije verzije Androida 4.4. KitKat API-ja, koji jo nije toliko
rasprostranjen na tritu zbog ograniene dostupnosti na odreenim mobilnim ureajima i tabletima. Vei naglasak je
stavljen na primjenu tehnika i tehnologija koje su usko vezane za Cloud Computing, odnosno raunalstvo u oblaku. Neke
od novosti su ugraena mogunost za ispis sadraja prikazanog na ekranu pomou pisaa, uteda energije primjenom
senzora pokreta, novi pristup u organizaciji memorijskog i spremnikog prostora izvravanjem aktivnosti u pozadi OS-a,
smanjena mogunost ruenja aplikacija itd.

ABSTRACT
Android OS is today one of the most widespread used OS on mobile and tablet devices. The reason why there is an
interest in writing about this topic is not only because more and more people replace work on computers and laptops to
mobile devices and tablets, it is because in the latest version of the Android OS are implemented innovative and fresh
solutions that allow the user simpler and faster work, better energy, time savings and less invested money. This work
presents new approaches and opportunities currently on the latest version of Android 4.4. KitKat API, which has not
been so widespread on the market due limited availability on certain mobile devices and tablets. Bigger emphasis is
placed on the application of techniques and technologies that are closely related to cloud computing. Some of these
innovations in KitKat include integrated option to print the content on the screen using printer devices, saving energy with
using motion sensors, a new approach in the organization of memory and storage tank, performing those activities in the
background of the OS, the minimum possibility of demolition applications and so on.

1. INTRODUCTION
The first appearance of the Android OS on a mobile
device took place on the commercial market in
September 2008. It is developed by the Google
Corporation along with the Open Handset Alliance
(OHA). Since the first version until today, Google has
released 19 different versions of Application
Programming Interface (API). This number is impressing
considering that this was a period of less than six years.
According to available statistical data on worldwide
basis the number of new delivered units of the Android
OS in 2013 is greater than 500 million which is
equivalent to 78.60% of the worlds market, followed by
iOS with 26.90% and WP8 with 1.60% (MobiThinking,
2014). If we are looking only on Android OS statistics
(Android Developers, 2014a), currently the most
common and most popular version is Android Jelly Bean
(API 16, 17, 18) with a 64.40% of contributions. Second
one is Gingerbread (API 10) with 17.80%, and third is
Ice Cream Sandwich (API 15) with 15.00%. On fourth
place is the latest version of Android 4.4. (API 19), also
known as KitKat, with a 5.30% share, having its
percentage doubled if compared to the second month of
the year. Demand for KitKat is steadily growing as it
brings
new
solutions,
capabilities,
enhanced
performance, minimized fragmentation, reduced OS; but
does not dramatically change graphical design in
comparison with predecessor Android Jelly Bean. There
are a few new features and improvements but not all of
them are perfect yet.

The purpose of this paper is to present new approaches


and possibilities for developers in using Android 4.4
KitKat API. The paper is divided into 5 chapters. Upon
the introduction presented in this chapter, the second
chapter presents general facts related to this version of
API and it also enumerates important new functionalities
which represent the building blocks for the third, fourth
and fifth chapter. The third chapter presents KitKat's
new capabilities that are related to Memory
management, file management, system-wide wireless
printing and integration with cloud storage, and at last
Android Transition Framework. The purpose of this
chapter is to familiarize developers with new
opportunities of applications development in KitKat. This
is the most important chapter of the paper, while the
forth chapter discusses differences between KitKat and
his predecessor Jelly Bean observed by the user side
(closely associated with the appearance and functions
of a graphical interface) and the last chapter concludes
the paper.

2. ANDROID 4.4. KITKAT API


Smart, simple, and truly yours" - this is the slogan of
the latest version of Android 4.4., popularly known as
KitKat. Nestle, the KitKat brand owner, promotes the
Android logo on the chocolate wrappers and thus
promotes the new OS.
KitKat was first introduced in September 2013 and was
initially available only on Googles Nexus 5 mobile
devices. One of the important features of this version is

72

CASEmobile

that it tends to use smaller amounts of RAM, which is


not in common for most modern mobile devices. Google
has devoted special attention to this by organizing
"Project Svelte" (various memory-saving changes to
Android framework, improved memory diagnostics,
tuning knobs for Android etc.) whose results have
recorded positive success that was used on KitKat API.
The optimal amount of RAM is 512 MB and 340 MB is
the minimum, this is reasonable because most of
todays mobile devices have this size of RAM.
Table 1 - New capabilities in Android 4.4.
New capabilites of Android 4.4.
New Memory Management
New File Management (Google cloud support)
System-wide Wireless Printing
Step counting built-in Sensors
FullScrean Read (Immersive) Mode
Smarter caller ID
Faster Multitasking (improved touchscreen)
Quick Office working with documents
Widgets in lockscreen
New Alarm System Notification
Chrome web view
Infrared blasting (Tv remote control)
Application sandboxes
Low-power location monitoring
Bluetooth Message Acces Profile (MAP) Support
KitKat also brings new memory and file management,
native cloud support, improved multitasking, widgets in
lock screen, application sandboxing, low-power
application
monitoring
and
other
under-hood
improvements in many OS elements. The complete list
of improvements is presented in Table 1, and some of
them are described in next chapters.

Preload dex caches in Dalvik (saved several MBs


in process virtual machine).
Validated Dalvic JIT-off option (just-in-time
compiler option saves up to 1.5MB per process).
Reduced per-process font cache overhead.
Introduced ArrayMap, ArraySet and used
extensively in framework as a lighter-footprint
replacement for HashMap, HashSet.
New API called ActivityManager.isLowRamDevice() will
determine if apps run on low memory device and will act
if apps have specific memory-intensive features that
work poorly, so they can be turned off (some Google
apps are reportedly coded to make this check). To be
able to work, this API must be set true by the system
property in the device makefile:
PRODUCT_PROPERTY_OVERRIDES +=
ro.config.low_ram=true
Google also gave better support to developers and
Original Equipment Manufacturers (OEM) who can
easily take advantage of large set of tools and
accessories available to them. Thus, developers can
better monitor the memory usage and work timeline with
some of the following tools and activities:
new tool procstats GUI inside device settings
SettingsDeveloper optionsProcess Stats
new adb shell dumpsys procstats command-line details about memory use over time, with run times
and memory footprint
new adb shell dumpsys meminfo (similar to toolset procrank but with more clear info)
toll bugreports over adb - the services now include
batterystats, procstats, usagestats and netstats.

Generally speaking, KitKat is smoothly polished and it


offers a huge number of applications that are built into
the OS and give great benefits to users and developers.

3. NEW POSSIBILITIES IN KITKAT


3.1 Memory Management
Android devices need memory for OS, background
services, video buffers and apps. Generally, the Android
OS for work with memory uses paging or memorymapping (mmaping). When change happens in memory,
whether it is about new object or the opening mmpaped
site it will be recorded in the memory and the object will
not be released until the release reference is set and
placed in Garbage Collection. Activity Manager
constantly sorts out the applications by per-process
measure called oom_adj, and as memory pressure
increases, the low memory killer starts killing processes.
As it was mentioned earlier, KitKat is designed to work
with RAM memory of 512MB, and this was achieved
with behind-the-scenes improvements. For this purpose
they had made revisions to remove the unnecessary
backgrounds services and accessories/features that had
plagued the multiple memory processing. Such
optimization with new APIs effects on all installed
applications for entry-level and upper-class devices and
allows better multi-tasking. System memory is reduced
with following (Android Developers, 2014b):
Trimmed system server and SystemUI processes
(saved several MBs).

Figure 1 - New Tool procstats GUI in KitKat (Wallat,


2013)

CASEmobile

73

shows an app run in Dalvik Debug Monitor Server


(DDMS) with two services that ran once at startup.
Service ExpectedQuickService is running 92% of the
apps run time, while service ExpectedSlowService
0.23% of the apps run time. Just by looking at this report
we can identify where the problem is.

Figure 3 New SAF view

Figure 2 - ADB shell procstats details (Smith, 2013)


New memory management offers safer and neater work
due to the use of Application sandboxes with SecurityEnhanced Linux. Shortly, each app runs in a restricted
environment, similar as in iOS, which has prevented the
apps that perform illegal actions. Now they cannot read
or change data of other Apps. On the other hand that
has made a big problem in case when user or OS wants
to make changes on the SD memory card and other
external media with content that was created by
previous API versions.

3.2 New File management


Android 4.4 offers a new, so-called, Storage Access
Framework (SAF) in which users can interact with
stored content as images, videos and documents. For
example if user wants to send a message, UI lets user
to browse files and access to recent content in
consistent way across app files and providers instead of
showing user a dialog to choose an application to
handle content. The UI is standardized and easy to use
because it combines a variety of applications as Google
Drive, Dropbox, download folder with the content and
gallery in one central location, together with
corresponding data (see Figure 3). Developers can use
and operate with centralized file management location
where they can add their own storage service without
making it on the vendor by vendor basis. Using SAF, i.e.
cloud storage is useful on mobile devices for two
reasons:
a) Internet connection becomes faster, efficient
and provides an inexpensive transmission of
large amounts of data.
b) Mobile devices have not yet overgrown the size
of the PCs or laptops storage space.

Client apps that need access to a provider's documents


can integrate with the SAF in a few lines of code by
implementing a document provider (which offers read
and write access to durable files, such as files stored on
a local disk, or files in cloud storage). The SAF includes
the following:
Document provider
Client app
Picker - system UI that lets user access
documents from document providers that satisfy
the client app search criteria.
Cloud providers or local storage services (offered by
individual Android manufacturers) can use the new
system by implementing a new document provider class
within Android for their service, the document provider
class within Android has the APIs necessary to manage,
browse, read or write documents within the app from a
variety of sources (Rowinski, 2013). In this way
providers and clients dont interact directly because
client request permission to interact with files. Some of
the features offered by the SAF are following (Android
Developers, 2014c):
It lets users browse content from all document
providers, not just a single app.
It makes it possible for app to have long term,
persistent access to documents owned by a
document provider. With this access users can
add, edit, save, and delete files on the provider.
It supports multiple user accounts and transient
roots such as USB storage providers, which only
appear if the drive is plugged in.
For example, Figure 4 shows how a photo app might
use the SAF to access stored data:

74

CASEmobile
With document URI, document can be open; here is an
example of how to open a Bitmap:
private Bitmap getBitmapFromUri(Uri uri)
throws
IOException
{
ParcelFileDescriptor
par = gettContentResolver().
openFileDescriptor(uri,
"r");
FileDescriptor file =
par.getFileDescriptor();
Bitmap image = BitmapFactory.
decodeFileDescriptor(file);
par.close();
return
image;
}
Code 3 Method for opening the selected bitmap file

Figure 4 - Storage Access Framework Flow (Android


Developers, 2014c)
The following example shows how to load and save
content with SAF on client side (request Content from a
Provider). Local providers, cloud services, and external
storage use DocumentsProvider class with
abstract ContentProviders interface and are
treated in the same way providing the developer with
one place to interact with the users content. Developers
need to call ACTION_OPEN_DOCUMENT Intent to pick
content, which signifies that we want to connect to all
content providers available to the device. Calling
StartActivityForResult will launch SAF UI (see
Figure 3).
It is possible to implement filtering to this Intent based
on MimeType by specifying CategoryOpenable,
which means only content that can be opened will be
returned. The code below shows filters for image results
by specifying the image MimeType:
public void searchFile(){
Intent intent = new Intent
(Intent.ACTION_OPEN_DOCUMENT);
intent.AddCategory
(Intent.CATEGORY_OPENABLE);
intent.SetType ("image/*");
StartActivityForResult (intent,
SAVE_REQUEST_CODE);
}
Code 1 Method for filtering the documents by
Mimetype
If image is selected, OnActivityResult returns the
Android.Net.Uri of the chosen file. The code
sample below displays the user's image selection:
protected
override
void
OnActivityResult(int requestCode, Result
resultCode, Intent data) {
base.OnActivityResult(requestCode,
resultCode, data);
if (resultCode == RESULT.Ok &&
data != null && requestCode ==
SAVE_REQUEST_CODE) {
ImageView imageView =
FindViewById<ImageView>
(Resource.Id.imageView);
imageView.SetImageURI
(data.Data);
}
}
Code 2 User's image selection

In case when new file is created, user must press Save


button, OnActivityResult gets passed the URI
which can be accessed with data.Data. The Uri can
be used to stream data into the new file:
private void createFile(String type,
String fileName) {
Intent intent = new Intent
(Intent.ACTION_CREATE_DOCUMENT);
// Filter to only show results that
can
be
"opened"
intent.addCategory
(Intent.CATEGORY_OPENABLE);
//
Create
a
file
intent.setType(text/plain);
intent.putExtra
(Intent.EXTRA_TITLE,
fileName);
startActivityForResult(intent,
WHRITE_REQUEST_CODE);
}
Code 4 Creating new document in a document
provider
Persistent access to a specific file can be obtained by
taking the necessary permissions for the Uri. The
following code read and writes permissions for
referenced file by the fileUri instance (Android
Developers, 2014c):
final int takeFlags = intent.getFlags()
&(Intent. FLAG_GRANT_READ_URI_PERMISSION
|Intent.
FLAG_GRANT_WRITE_URI_PERMISSION);
// Check for the freshest data
getContentResolver().takePersistableUriPe
rmission(fileUri, takeFlags);
Code 5 Permissions
New changes have been made in the approach to
External storage, divided into two types:
Storage unique to developer app,
Data shared by multiple applications
The external storage API was split out to include
multiple volumes, one primary and one or more
secondary (modify write permissions). Apps cant read
or write shared files on the external storage while they
are
running,
unless
they
have
READ_EXTERNAL_STORAGE
or
WRITE_EXTERNAL_ STORAGE permission. Write
permission implies the read permission. Therefore it is
necessary to set one of these two permissions inside
the application.

CASEmobile

3.3 New System-wide Wireless Printing and


Integration with existing Cloud Storage
KitKat also brings a new feature to print documents and
photos right from the phone. Google made it possible by
implementing direct support for Google Cloud Print, a
technology connecting printers to the cloud. It enables
users to connect their phone to the printer over WiFi or
Bluetooth and print selected documents in a very short
period of time. However, this feature is limited to
compatible printers having Cloud Print support and
wireless technology built-in. Its important to point out
that before printing; each document has to be converted
to PDF which is a default format for printing. In addition,
printer manufacturers (OEM) can use new APIs to
develop their own printing services - pluggable
components that add services (vendor-specific logic) for
communicating with specific types of printers that are
available on Google Play. They can use the
android.printservice framework to provide
interoperability with printers from Android devices.
One of the KitKats important features is Google Cloud
Storage, its previously existing support to use Google
Drive service meant for storing and sharing documents
and files (users have fast access to your apps data
from any location based on global edge-caching). A
user can save and open document or file directly from
cloud, without previously saving it to their phones
storage. An app like QuickOffice (made for creating and
editing Microsoft Office documents, spreadsheets and
presentations) already has the ability to connect with
Google Drive.
By combining Cloud Storage and Cloud print
technologies, Google enabled users to print files from
their PC or tablet, and developers got a possibility to
save files with high reliability and availability. The
following example is dedicated to document printing
possibilities of content that is currently shown on the
screen. Base for that is usage of WebVIew class, which
in its latest version supports HTML5 features, CSS3, V8
JavaScript engine and remote debugging of WebView
content. The same was not supported in the previous
versions, but now, developers got the new powerful way
to develop web-based apps. New WebView is based on
Chromium (open-source browser project that aims to
build a safer, faster, and more stable way for all Internet
users to experience the web) designed for Chrome
Android browser version 30.

75

For printing a web-page which consists of dynamic


HTML content, Android Printing Framework has to be
implemented within the source code of the application.
The beginning step is to change the manifest.xml
file where its necessary to set targerSdkVersion
to 19 and turn on the rule to enable internet
connection.
To work with objects that are related to the WebView
class the following classes must be imported:
android.webkit.WebView;
android.webkit.WebViewClient;
And to work with objects that are related to printing the
contents, following classes should be imported:
android.print.PrintAttributes;
android.print.PrintDocumentAdapter;
android.print.PrintManager;
Inside the main class which extends the Activity class in
the method onCreate() the following code loads the
dynamic html page and creates an instance of WebView
class which is assigned to WebViewClient:
WebView webView = new WebView(this);
webView.setWebViewClient(new
WebViewClient() {
public boolean
shouldOverrideUrlLoading(WebView
view, String url) {
return false;
}
@Override
public void onPageFinished(WebView
view, String url) {
webPrint(view);
myWebView = null;
}
});
webView.loadDataWithBaseURL(null, html,
"text/HTML", "UTF-8", null);
}
Code 6 Loading website and creating new WebView
instance
When HTML content of the web page is loaded into the
WebView object, method onPageFinished() will be
triggered that will save a reference of WebView object
and invite WebPrint (view) method that opens a window
for the print properties (printing panel). The document
will be converted to PDF format, and this code is shown
below:
webPrint(WebView view){
PrintManager printManager =
(PrintManager)this.getSystemService
(Context.PRINT_SERVICE);
PrintDocumentAdapter printAdapter =
view.createPrintDocumentAdapter();
String name = "Print Test";
printManager.print(name,
printAdapter, new PrintAttributes.
Builder().build());
}
Code 7 Method for calling print settings

Figure 5 System-wide Wireless Printing

WebPrint
method
retrieves
references
to
PrintManager service, gives WebView instance and
creates a print adapter. Metod print() inside the print

76

CASEmobile

manager method pass through the job name, print


adaptor and a set of default print attributes. Once the
print job is instantiated, it is necessary to check whether
the generated output is located at the selected location.

3.4 Android Transition framework


This chapter demonstrates how to use Animating User
Interfaces with the new Android Transitions Framework
(transitioning from one scene to another). In short, this
Framework makes animations easier to use and make.
Developers have now more control over animations,
they can build complex animations with minimal working
hours. This is because KitKat allows them to perform a
simple property animation with one line of code and by
importing libraries:
android.Transitons;
android.transition.TransitionManager.
To animate showing and hiding a TextView, in case
when the button is pressed, we can use the following
code example:
LinearLayout linear = (LinearLayout)
findViewById(R.id.myWebView);
Button button = (Button)
findViewById(R.id.button);
final TextView text = (TextView)
findViewById(R.id.textView);
button.setOnClickListener(new
View.OnClickListener() {
@Override
public void onClick(View v) {
TransitionManager.beginDelayed
Transition(linear);
if(text.getVisibility() !=
View.VISIBLE){
text.setVisibility(View.
VISIBLE);
}
else{
text.setVisibility(View.GONE);
}
}
});
Code 8 Text view transition
We can get more control over the transition with
Scenes. Scenes create a dynamic area in the UI using
Scenes class. Android does the rest of the work to
animate the transitions between the scenes but first
developers must specify a container and several
versions, or "scenes", for the XML content inside the
container. To transition between two scenes, developers
generally need to perform the following (Android
Developers, 2013):
Specify the ViewGroup containing the UI
components you want to change.
Specify the layout representing the end-result of
the change (the next scene).
Specify the type of transition that should animate
the layout change.
Execute the transition.
Scene object must be used to accomplish steps 1 and
2, and TransitionManager object to accomplish
steps 3 and 4. A Scene contains metadata describing
the properties of a layout that are necessary to perform
a transition, including the scene's parent view and the
scene's layout. For the following code example,
dynamic content inside the container requires two new

Android layouts. These layouts specify only the code


inside the container
which in our case is
scene_activity.xml.
For proposes of this example, the two XML layouts have
been created, and are included inside the container:
first_scene_layout.xml where all elements are
aligned horizontally and second_scene_layout.xml
where all elements are aligned vertically see Figure
6.
A
Scene
is
created
by
calling Scene.getSceneForLayout, passing in the
container object, the Resource ID of the Scene's layout
file, and the current Context. Below is a sample code
for MainActivity class:
Scene first_scene;
Scene second_scene;
Transition transition;
@Override
protected void onCreate(Bundle
savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.
scene_activity);
ViewGroup rootContainer = (ViewGroup)
findViewById(R.id.rootContainer1);
transition = TransitionInflater.
from(this).inflateTransition
(R.transition.transition);
first_scene = Scene.
getSceneForLayout(rootContainer,
R.layout.first_scene_layout,
this);
second_scene = Scene.
getSceneForLayout(rootContainer,
R.layout.second_scene_layout,
this);
first_scene.enter();
}
public void firstScene(View view){
TransitionManager.go(second_scene,
transition);
}
public void secondScene(View view){
TransitionManager.go(first_scene,
transition);
}
Code 9 The Main activity class showing way to
manage the scene transition
First, it is necessary to add some code to load the layout
from second_scene_layout.xml file into a Scene
instance. After that we can implement the transition
between the first and second scene with two methods
firstScene(view) and secondScene(view).
These methods are called when one of the buttons is
pressed in layout:
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 1"
android:onClick="firstScene" />
Code 10 Button settings

CASEmobile

Figure 6 Transition between two scenes


Their function is to load the transitions into a
TransitionManager instance and reference it in the
scene changes. Developers can also define sets of
transitions
programmatically
with
the
TransitionManager APIs. All of the transition effects
for this project are implemented within a transition XML
resource file. Transition resource files must be placed in
the res/transition folder of the project. With the newly
created transition.xml file selected and loaded into the
editing panel, the following XML content is added in a
transition set that enables the change bounds transition
animation with a duration attribute setting:
<transitionSet
xmlns:android="http://schemas.android.com
/apk/res/android">
<changeBounds
android:duration="1000">
</changeBounds>
</transitionSet>
Code 11 Transition settings
With the transition file integrated into the project, any
number of additional transitions may be added to the file
without the need to make any further changes to the
source of the activity. When specifying a transition,
developers can use several predefined types defined by
subclasses
of Transition,
such
as Fade
and ChangeBounds. If transition type is not specified a
transition type, the system uses AutoTransition by
default, which automatically fades, moves, and resizes
views as necessary.

4. COMPARING KITKAT AND ANDROID


JELLY BEAN
Important new things in Android KitKat, which have not
been mentioned before, if compared to the previous
version Jelly-Bean (API 16, 17, 18) are listed in the table
2 below:
Table 2 Differences between Android Jelly Bean and
KitKat (Allumalla, 2013)
Difference between Android Jelly Bean and Kitkat
Improved battery usage
Supports 4k resolution
Multi-sensory user experience
Supports tri-core CPU

77

New framework for UI transitions


Improved performance and security
Disabled access to battery statistics
Edge to Edge display provides a comfort for the user in the
work
Low-power location monitoring
Audio tunneling and monitoring, loudness enhancer
More camera options: faster shooting, more accurate
focusing, better balance etc.
Built-in infrared blaster support and a redesigned
downloads app
The differences between these two versions at first sight
may not seem to be much in the graphic design (search
tab, notification bar, etc.). So for example, KitKat uses a
thinner font of the text and the dominant color is white,
instead of the previous Jelly Bean blue. Standard icons
embedded applications are redesigned, while the Apps
and Widgets tabs are not changed and the Play Store
icon remains on the top-right part of the app drawer. If
the call was made, and the number was not found in the
users phone book, Google will recognize it, do a quick
search and if it finds in info site, it will display basic
information along with the address of the site.
There is installed possibility of restricting related data
transmission over the network; under the option "Data
usage". It is necessary to include a limit set and
determine the allowed size of the volume. Google
Hangouts (all-in-one solution) is a new messaging
system, which locates in one place all discussions of
SMS and MMS. Additionally there is support for highdefinition video calls, so it is not necessary reach out to
install industry-leading applications as Skype, Viber or
WhatsApp's.
Android KitKat has a step detector and step counter so
that fitness-related apps can track when the user is
walking, running, and climbing stairs. The step detector
uses the accelerometer input to recognize when the
user has taken a step. The step counter tracks the total
number of steps since the devices last restart. Google
is working with hardware manufacturers work together
to allow for collection and delivery of sensor data on
Android device while allowing devices processor (CPU)
to stay in low-power mode. (Chowdhry, 2013)
KitKat takes system performance to an all-time high by
optimizing memory and improving touchscreen so that it
responds faster and more accurately than ever before,
this means that user can listen to music while browsing
the web, or race down the highway with the latest hit
game, all without a hitch (Rowinski, 2013). KitKat
improves user access by providing support for systemwide closed captioning settings; the user defines which
sections he want to be shown and how. With device that
runs KitKat API and a Chromecast (thumb-sized media
streaming device that plugs on HDTV into the HDMI
port), users can enjoy in online entertainment (YouTube,
Hulu-Plus, Google Play). Android supports closed
captioning and subtitles, and music can be now listened
longer, up to 60 hours of audio playback. In previous
versions major problems were caused by working with
fragments. In KitKat this was resolved with memory
optimization, what helps Android to expand better and
decrease crash rate.
However, even though there are many changes in the
new version, the glimpse view in changes made in
source code between API 18 and 19 reveal that the
overall difference is 2.63%.

78

CASEmobile

5. CONCLUSION
Android 4.4. KitKat API is 19th API release for Android
platform that offers new features for users and app
developers. Google doesn't deliver a huge list of
transformative design and feature changes, but provides
support that allows developers to develop applications
easier. The main feature of the new mobile OS is
adaptation to lower hardware capabilities with less
working memory and lower screen resolution. Within
this article, the attention is placed on possibilities for app

development using new memory management, working


with documents by using the new storage access
framework, setting print options and content integration
with Google cloud print and a new form of work with
transmissions and scenes changes on the device
screens.
The developers will find code examples and guidelines
in using the most important benefits of presented KitKat
API.

References:
1

Allumalla, A.R., 2013. Difference between Android Jellybean 4.3 and Kitkat 4.4 / [WWW Document]. Techzost. URL
http://blog.techzost.com/4185/difference-android-jellybean-43-kitkat-44/2013/10 (accessed 5.1.14).

Android Developers, 2013. Android 4.4 APIs [WWW Document]. Android Developers. URL
https://developer.android.com/about/versions/android-4.4.html#SMS (accessed 5.5.14).

Android Developers, 2014a. Dashboards | Android Developers [WWW Document]. Android Developers. URL
http://developer.android.com/about/dashboards/index.html (accessed 4.29.14).

Android Developers, 2014b. Running Android with low RAM [WWW Document]. Android Developers. URL
https://source.android.com/devices/low-ram.html (accessed 4.30.14).

Android Developers, 2014c. Storage Access Framework [WWW Document]. Android Developers. URL
https://developer.android.com/guide/topics/providers/document-provider.html (accessed 5.5.14).

Chowdhry, A., 2013. 10 Of The Best Android KitKat Features [WWW Document]. Forbes. URL
http://www.forbes.com/sites/amitchowdhry/2013/11/04/10-of-the-best-android-kitkat-features/2/ (accessed 5.12.14).

MobiThinking, 2014. Global mobile statistics 2014 Part A: handset market share [WWW Document]. URL
http://mobithinking.com/mobile-marketing-tools/latest-mobile-stats/a#smartphone-shipments (accessed 5.8.14).

Rowinski, D., 2013. 10 Things Developers And Users Need To Know About Android KitKat 4.4 [WWW Document].
ReadWrite. URL http://readwrite.com/2013/11/07/android-kitkat-developers-users (accessed 5.1.14).

Smith, C., 2013. Android KitKat Development Tools - Procstats [WWW Document]. Double Encore. URL
http://www.doubleencore.com/2013/11/android-kitkat-development-tools/ (accessed 5.12.14).

10

Wallat, J., 2013. Android 4.4 KitKat: here are the hidden functions - AndroidPIT [WWW Document]. AndroidPIT.
URL http://www.androidpit.com/android-4-4-hidden-functions (accessed 5.1.14).

Information on authors:
Zoran Kos B.Sc
e-mail: zoran.kos@foi.hr
Zoran Kos is 2nd year student of Information and Programming engineering of Faculty of Organization and Informatics in
Varadin. Main interests are programming web, desktop and mobile application, new IT trends like cloud computing and
mobility, making and presenting business models for startup projects. While developing new apps he focused on frontend development. He already has few smaller but successful projects behind him.
Zoran is the main contributor to this paper. He wrote the first version of the text and did coding of the presented
examples.
Zlatko Stapi, PhD.
e-mail: zlatko.stapic@foi.hr
Faculty of Organization and Informatics
Pavlinska 2, 42000 Varadin, Tel: +385 42 390 820, Fax: +385 42 213 413
Zlatko Stapi, PhD., works at the Information Systems Development Department at Faculty of Organization and
Informatics in Varadin. He obtained his PhD in computer sciences from University of Alcal (Spain) and in information
sciences from University of Zagreb (Croatia) in cotutelled doctorate program. His scientific and research interests include
software- and mobile applications development methodologies. He participated in more than 15 scientific and professional
projects and published more than 30 scientific and professional papers. Currently he leads the Laboratory for
Development and Transfer of Mobile Technologies (FOI MT-Lab). Zlatko is putting a special focus in inclusion of students
in his scientific and professional activities. The published papers, projects, awards and other relevant information can be
found on his personal website: http://www.foi.unizg.hr/djelatnici/zlatko.stapic.
Zlatkos contributions to this paper are only of corrective nature. He mentored student Zoran Kos in defining the body, the
structure and the style of the paper. After the first version of the paper is written, he proof-read the text and made
necessary changes to make the text more focused and readable.

CASEmobile

79

PLATFORMA ZA RAZVOJ MOBILNIH APLIKACIJA XAMARIN

Miljenko Cvjetko

SAETAK:
U okviru predavanja sluatelji ce biti upoznati sa osnovnim konceptima Xamarin tehnologija i alatima koji omoguuju rad
na vie platformi. Cilj predavanja je razbiti neke predrasude i zablude oko Xamarin tehnologija, te dati uvod u kojem se
smjeru kree krosplatformski razvoj aplikacija.

SUMMARY
Xamarin 2.0 tools brought breaking news for cross platform development of enterprise (line-of-business) applications and
have democratized .net and C# programming language with a giant leap accross platform differences based on mono
framework. One of the greatest breakthroughs is expected with Xamarin Test Cloud in the field of application testing
which is (at this point in time) very cumbersome and not widespread.

1. UVOD

Xamarin Studio MacOSX

Dokument je pregled trenutanog stanja Xamarin


tehnologija za mutliplatformski razvoj aplikacija,
prvenstveno mobilnih za iOS i Android, a zatim i ostalih
web i desktop.
Xamarin kao firma koja je svoj razvoj definirala na
mutliplatformskom razvoju prvenstveno mobilnih
aplikacija, podlona je utjecajima vanjskih firmi partnera
kao to su Microsoft, Apple i Google, ali i konkurencije.
Ponekad se i potezi partnerskih firmi drastino
odraavaju na Xamarin, pa ak i u negativnom smislu.
Glavni smjerovi razvoja Xamarin tehnologija danas je na
stabilizaciji vlastitih proizvoda, te proirenju istih, ako i
proirenju palete proizvoda.
Xamarin Studio Winodws

2. RAZVOJNI ALATI
Jedan od najbitnijih proizvoda Xamarina su IDE alati
Xamarin Studio i proirenja (addinovi) za Visual Studio
koji omoguuju razvojnim programerima ciljanje vie
platformi i integraciju razvojnog procesa.

2.1 Xamarin Studio / MonoDevelop


Nakon poboljanja performansi i zatim stabilizacije IDE
alata Xamarin Studio pristupljeno je modernizaciji
izgleda alata kozmetikim izmjenama, no ipak bitnima
za pridobivanje krajnjih korisnika.

Velika veina ovih promjena vidljiva je i u open source


alatu MonoDevelop na kojem je Xamarin Studio baziran.

80

CASEmobile

Xamarin Studio iOS Designer

Xamarin Studio Android Designer

Dijagnostika povezanosti Visual Studio alata sa Mac


stranom za razvoj iOS i Mac aplikacija bila je problem u
prolosti. Dijagnostiki dijalozi i postavke danas to jako
pojednostavljuju
Visual Studio iOS Connectivity Diagnostics

2.2 Visual Studio


Na Microsoft //BUILD konferenciji Xamarin je nastupio
kao jedan od vrlo jakih partnera Microsoftu, naroito
nakon nedavnih promjena na vrhu Microsofta, koje su
donijele nove vjetrove u odnosima.
Visual Studio je zasigurno jedan najboljih alata za razvoj
softwarea i nije udo da je odabir veine programera
koji rade sa .netom. Iz tih razloga Xamarin posveuje
jedan veliki dio svojeg rada integraciji Visual Studio
alata u svoje proizvode.

Serverski dio iOS integracije imao je potekoa zbog


greaka u implementaciji mono frameworka i runtimea
na nivou socketa. Nove verzije alata i runtimea rijeile
su veinu problema.
MacOSX Build Host

Visual Studio Xamarin Settings

Integracija za iOS development


iOS razvoj iz alata Visual Studio dobio je brojna
proirenja, tako da je uparivanje sa Xamarin MacOSX
Build Hostom mnogo transparetnije i lake. Olakana je
dijagnostika problema, a i performanse su poboljane,
to je povezano sa radom na ostalim Xamarin
proizvodima, prvenstveno runtimeu,ali i Base Class
Libraries implementacijom.

2.3 iOS Designer


Na Microsoft //BUILD/ konferenciji, jedno od
najposjeenijih predavanja i keynotea bilo je sigurno
predavanja Xamarin CTOa Miguela De Icazae. Samo
predavanje moralo se je prebaciti iz dvorane sa
dvjestotinjak mjesta u veliku dvoranu koja je bila
ispunjena sa blizu tisuu programera. U svom

CASEmobile

81

predavanju Miguel je dobio mnoge ovacije, no sigurno


najvea je bila predstavljanje iOS designera u Visual
Studio alatu. Koji je rezultat nastojanja smanjenja razlika
meu Xamarin proizvodima na razliitim platformama.

Nadalje veliki napori se ulau u integraciju sa nugetom i


nuget servisima.

Visual Studio iOS Designer

Nakon to je Apple kupio beta testing kompaniju koja je


razvila TestFlight i u roku od nekoliko dana iracionalno
ugasio podrku za Android platformu, Xamarin je
izgubio nekoliko mjeseci rada na integraciji TestFlighta
u svoje IDE proizvode, a multiplatformski programeri koji
koriste Xamarin tehnologije su se poeli okretati drugim
beta testing platformama.

3.1 Testing - End to End

Beta Testing integracija


Da bi se olakalo testiranje aplikacija (multiplatformski) i
distribucija istih do testera traene su alternative
TestFlight servisu. Neki zamjenski ubrzano se
integriraju u ekosustav Xamarina. Prvenstveno su tu
servisi poput ubertester.com i slini.
Beta Testing Servis ubertesters.com

2.4 Android Designer


Visual Studio Android Designer donio je mnoge
promjene, prvenstveno zakrpe i poboljanje radnih
uvjeta (performanse, neki featurei).
Visual Studio Android Designer

Xamarin Test Cloud


Servisi na Test Cloudu dobili su nove funkcionalnosti u
vidu vie ureaja, zatim daleko vie informacija o samim
testovima i puno prijateljskiji UI.
Namjerno prikazana greka ilustracija problema sa
kojima se susree Xamarin kao firma i korisnici Xamarin
tehnologija. Uzrok greke promjena APIa od strane
Googlea koje iziskuju update Android SDKa.

3. POBOLJANJA U PROCESU RAZVOJA


Xamarin strategija je to delight developers (obradovati
developere), te se velika panja pridodaje razvojnom
ekosustavu koji sigurno ubraja komponente kao
osnovne elemente izrade aplikacija (building blocks),
zatim testiranje koje ukljuuje beta testiranja, kao i
automatsko testiranje UIa u Xamarin Test Cloudu.

3.1 Component store


Komponente ili kako ih jo nazivaju packages, sigurno
su bitni dio olakavanja ivota programerima i samim
time skraenjem ciklusa razvoja i smanjenjem trokova
razvoja programske podrke. To su razlozi postojanja
sustava za distribuciju komponenti paketa kao to su
nuget i maven, te ostali.
Xamarin je otvorio svoj komponent servis (Component
Store) jo prole godine. Jo ove zime broj komponenti
preao je brojku od 150 i planira se 200 krajem godine
iako po trenutnom rastu taj broj bi mogao biti i 250300.

Xamarin Test Cloud

82

CASEmobile
Xamarin open source proizvoda i na svim ostalim
platformama, naroito Windows operativnim sustavima.

4.3 Core assemblies


Aktivnosti oko BCL (Base Class Library) prvenstveno je
usmjeren na rjeavanje greaka i problema, te
reorganizaciji strukture projekata koji bi trebali rijeiti
ciklike ovisnosti, te smanjiti broj meusobnih ovisnosti,
a samim time olakati build procese na svim
platformama.

4.4 ASP.net

4. PLATFORME
4.1 Mono runtime
Nakon produbljene suradnje sa Microsoftom ovoga
proljea veliki pomaci napravljeni su na integraciji mono
runtimea sa Microsoftovim novim compilerom Roslyn
projektom. Zajedniki rad i postignua prikazana su
takoer na //BUILD/ konferenciji.

4.2 Build proces


U svrhu stabilizacije sustava radi se na razrjeavanju
ciklikih ovisnosti meu komponentama i assemblyima.
Nakon rjeavanja ovih problema za oekivati je u
dogledno vrijeme jednostavnije prevoenje i pakiranje

Nakon objave da je nova verzija Microsoftove web


platforme ASP.net postala open source, te da je mono
platforma dodana u testnu matricu za ASP.net za
oekivati je da mnoge ASP.net web aplikacije presele
na ne Windows platforme, prvenstveno Linux. Ovo je i
do sada bilo mogue, dodue ne u potpunosti i ne bez
velike muke i znanja.
Self hosted owin, katana aplikacije na Linux
platformama nisu daleka budunost i za oekivati je
veliki broj Internet of Things (IoT) aplikacija koje bi
trebale koristiti ove platforme na Windows i Linux
embedded sustavima.

5. ZAKLJUAK
Ovo je bio samo jedan povrinski pregled s visokog o
trenutanom stanju tehnologija koje razvija Xamarin na
mobilnom, ali i na serverskom dijelu u suradnji sa svojim
partnerima / prvenstveno Microsoftom.

Podaci o autoru:
Miljenko Cvjetko
e-mail: mcvjetko@holisticware.net
e-mail: miljenko.cvjetko@xamarin.com
http://holisticware.net
http://xamarin.com
HolisticWare is startup company whcih develops mobile apps with .net technology. In 2011 teams top prioities were
developing with Mono technology (open sourced .net port) to non-indows platforms, especially iOS and Android.

CASEmobile

83

KORITENJE ANDROID ANNOTATIONS I ACTIVE ANDROID RAZVOJNIH OKVIRA


USING ANDROID ANNOTATIONS AND ACTIVE ANDROID DEVELOPMENT FRAMEWORKS
Alen Huskanovi, David Ante Macan

SAETAK:
Android je danas najpopularniji operacijski sustav za mobilne platforme. No, unato svojoj popularnosti, nativan razvoj
aplikacija za Android zna biti poprilino dugotrajan muktorpan posao, te je ponekad ak i za jako male i jednostavne
aplikacije potrebno ubaciti puno koda. Upravo iz tog razloga, danas se javlja sve vie i vie novih i inovativnih opensource rjeenja koja smanjuju taj problem iz pojedinih aspekata. Android Annotations i Active Android upravo su takva
rjeenja koja se danas koriste sve vie u sve ozbiljnijim projektima. Active Android ORM je alat koji uvelike olakava
manipulaciju bazom podataka, dok je Android Annotations razvojni okvir koji nam prua skraeno pisanje mnogih
popularnih dijelova koda koji se s vremenom i veliinom aplikacije sve vie gomilaju. Oba ova razvojna okvira koriste
anotacije u programskom jeziku Java, te uvelike skrauju pisanje koda, to omoguuje developerima da se vie
fokusiraju na inenjering i dizajn aplikacije, nego na samo pisanje koda.

ABSTRACT:
Nowadays, Android is the most popular mobile operating system. But, although its popularity, native Android application
development can be quite time and energy consuming work. Sometimes, it is necessary to write a lot of code even for
small and simple applications. That is exactly why there are more and more various new open-source solutions that take
care of those problems from different aspects. Android Annotations and Active Android are such solutions that are being
more and more used in lot of serious projects. Active Android is an ORM tool that eases database manipulation a lot. On
the other hand, Android Annotations is an framework that offers us shortened writing of the popular parts of code, and
increases the complete code readability. Both of these frameworks use annotations in Java programing language and
reduce the code writing a lot, which enables the developers to be more focused on engineering and design of the
application, instead on focusing on code writing.

1. INTRODUCTION
The successful development of mobile applications is
largely dependent on the quality of written code.
Unfortunately, today the code is increasing rapidly and it
should be reduced. Specifically, regarding the
development for Android, very often for some general
things there must be code written that is already mostly
predefined and in the high ratio it does not change from
application to application. By writing such code,
developers spend precious time reading it and it
becomes cumbersome and unreadable.
From the above mentioned reasons, some developers
are trying to make their own development frameworks
that will replace the entire predefined code with only a
few lines of their own, and with that save a lot of time.
The aim of this paper is to introduce developers who
develop applications for Android that there are
developmental frameworks that can help them with the
speed and quality of development of mobile
applications.
This paper is divided into three chapters; in the first one,
Active Android development framework will be
explained, which is ORM for Android. The next chapter
is intended for Android Annotations development
framework, which with the help of Java Annotations
helps in reducing a lot of code. The final chapter is
intended for the comparison of native approach with the
usage of a development frameworks where the

advantages will be shown, as well as the disadvantages


of using those very same frameworks.

2. ACTIVE ANDROID
2.1 Introduction to Active Android
As an Android operating system framework, Active
Android is an ORM (object relational mapper) library.
Active Android allows you to manipulate data in
database over SQLite database management system. It
provides quick and easy usage without using any of the
SQL queries directly. Developers don't even need to
know SQL to use this framework[1]. Active Android
provides usage with the records in the database via
objects, so that the developers don't have problems with
conversion of tabular entries into objects and vice versa.
Model class represents a table and class instance
represents a record in table. Database management
with Active Android is much simpler and faster because
developers can create a class and with annotation tell
the system that that class represents table in the
database. Active Android does all the work around the
database setup so that the developers don't have to
write CRUD methods themselves.
Nowadays the Active Android is one of the most useful
frameworks for programming applications on Android
operating system as shown by the increasing number of
users. The source code of the framework can be found
at Github where everyone can take it and use it [2].

84

CASEmobile
android:value="CaseApp.db" />

2.2 Using Active Android


In this section, we will create a very simple mobile
application with database for chocolate sale. We will
create this database in both standard and Active
Android way. Lets create a use-case here and say that
we wish to delete the first receipt with a salesman
Mario who sold the chocolate Dorina.

<meta-data
android:name="AA_DB_VERSION"
android:value="1" />
...
Now we are ready to start coding our database. Instead
of creating DatabaseHelper and DatabaseAdapter
classes, we just need to add few modifications to the
existing model classes:
Receipt.java
@Table(name = "receipts")
public class Receipt extends Model {
@Column(name = "chocolatte")
private Chocolatte chocolatte;
@Column(name = "salesman")
private Salesman salesman;
@Column(name = "time")
private String time;

Figure 1 - ER model of example database


For that, we need to do the following steps:
Create tables and model classes
Insert required data
Read the inserted data
Print the data to the screen
Native approach:
Using standard approach without Active Android, we
usually need to create DatabaseHelper class that
contains methods and attributes for setting up and
updating the database. Using this class, we need to
specify both database name and database version,
alongside with adding SQL code for creating and
dropping every single table that our database will
contain.
To improve efficiency and reduce typo errors, we
usually put the CREATE TABLE string into the class
that represents the table that is to be created. We
created the SalesmanSQL.java and ReceiptSQL.java in
the same manner. After the representative model
classes were created, we need to create
DatabaseHelper class that helps us connect to the
database and creates tables using previously mentioned
CREATE TABLE strings.
And final class that we need to create is called
DatabaseAdapter. This class provides us with all the
CRUD methods for our tables. Unfortunately, coding of
this class usually takes quite a lot of time. The problem
with database adapter is that it is usually very large,
because we need to add qute a lot of code for each
table individually. After setting up the database, we can
start using it.
Active Android approach:
To use Active Android, we just need to setup few things
and we are ready to code. First of all, we need to
override default Application class for our app and add a
reference to it in the manifest file. Besides that, we also
need to write database name and version inside the
manifest file. We do this like in the following example:
AndroidManifest.xml
...
<application
android:allowBackup="true"
android:name="CaseApp"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<meta-data
android:name="AA_DB_NAME"

public Receipt() {
}
...
As shown above, using Javas annotation processing
tool, Active Android allows us to define our table inside
its appropriate model class. Notice also that this time
we didnt add the id attribute in our class. That is
because Active Android itself handles it and Model class
allows our classes to inherit that attribute. As for the
foreign keys, Active Android improves that part as well.
If we put into a column an attribute that is a child of
Model class, Active Android automatically creates
foreign key for that column. Another noteworthy fact is
that Active Android provides us a way to just query the
database and it handles the whole linking and
communication process with the database, which
allows the developer to focus more on designing and
developing, instead of mindless coding.

Receipt.java
...
//Some query methods
public static Receipt readReceiptById(long id) {
return new Select().from(Receipt.class).where("Id =? ",
id).executeSingle();
}
public static List<Receipt> readAllReceipts() {
return new Select().from(Receipt.class).execute();
}
public static Receipt
readReceiptForSalesmanAndChocolatte(Salesman salesman,
Chocolatte chocolatte) {
return new Select().from(Receipt.class).where("salesman
=? AND chocolatte =? ",
salesman.getId(),
chocolatte.getId()).orderBy("Id").executeSingle();
}
...

Finally, we can show how to use the database:

Creating chocolatte, salesman and receipt:


Chocolatte dorina = new Chocolatte("Dorina", 4.00);
dorina.save();
Salesman mario = new Salesman("Mario", 22);
mario.save();
new Receipt(dorina, mario, currentDate()).save();

CASEmobile

Reading that receipt from the database


Receipt receipt =
Receipt.readReceiptForSalesmanAndChocolatte(mario,
dorina);
Deleting that receipt from the database
receipt.delete();
3. ANDROID ANOTATIONS
3.1 Introduction to Android Annotations
Lately, among Android developers is discussed the
concept of Diet Driven Development, and anyone who
is familiar with this concept is also familiar with Android
Annotations framework which will be presented in this
chapter[3].
Android Annotations is a development framework for the
Android operating system which reduces the
unnecessary code; using Java annotations, developers
can show their intent and let Android Annotations
generate the plumbing code at compile time[4].
This development framework helps developers in writing
neat and readable code, and thus allows faster
production and faster debugging while developing
Android applications. Android Anotations is free to use,
and full source code is available on GitHub[5].

3.2 Using Android Anotations


In this section, we will try to induce some of the practical
usages for Android Annotations framework. Lets start
with the first class that is created when the project is
generated. That is MainActivity class that (usually)
extends Activity. Every Android developer knows that,
by default, every Activity has its onCreate method
which gets called every time the activity gets created.
But the problem is that this method looks almost always
the same, but it takes couple of lines of code just to
write it and specify the layout for the activity. Using
Android Annotations, we can clean that code as shown
in next example:
@EActivity(R.layout.activity_main)
public class MainActivity extends Activity {
@AfterViews
void main() {
// Do something
}
}
As shown in the example above, it is very simple to
specify the designated layout for the activity, as well as
the method that is to be invoked after activity gets
created. If our activity is to be used with Android
Annotations, we must provide an annotation @EActivity
(as shown in the example above). Using this analogy, it
is clear that @AfterViews annotations specifies the
method that is called after the activity is created. This is
a very simple, but effective demonstration of Android
Annotations power.
Another thing in Android that can easily increase the
code amount a lot (especially if it is done multiple times)
is the process of binding xml elements together with the
Java variables. Using native approach, we need to take
following steps:
Create designated View variable
Specify that the variable is to be used for View
element with certain id
Cast the View if necessary

85

Using Android Annotations, this is done simply by


Adding @ViewById annotation as shown in the next
example:
@ViewById
TextView txtLabel;
The code above automatically binds View element with
id txtLabel from given layout to the txtLabel variable.
Fortunately, Android Annotaions can detect variable
name and recognize it as an id, but we arent forced to
use that naming convention. If we decide to call id
different than the variable name, we can simply add an
annotation attribute with the elements id like this:
@ViewById (R.id.txtMyId)
There are plenty more situations like this in which
Android Annotations provide a simple and elegant
solution. For example, there is a @Click annotation
which is used to handle click events for designated
views, @ItemClicked annotation that handles list item
click events, etc.
Another great example of necessary native complex
code is the AsyncTask. By default, AsyncTask is used
for safe and proper synchronization of the background
thread and UI thread. The only problem is that it is
relatively large and complex to write. Using
AndroidAnnotations, this is solved in again, very simple
and elegant way. Simple way of replacing AsyncTask
with Android Annotations is shown below:
@Background
private void doInBackground() {
// Do some background work
updateUIThread();
}
@UiThread
private void updateUIThread() {
// Do some UI work
}
So, the big and complex AsyncTask is replaced with two
simple methods. When called, doInBackground
method will do its work in background thread and
update UI Thread when done.
There are many more annotations in this framework that
aim to ease native Android development a lot. Some of
the things that are improved a lot with this framework
are:
Rest API implementation (@Rest, @Get, @Post,
)
Activity saved instance state (@InstanceState)
SeekBar
events
(@SeekBarProgressChange,
@SeekBarTouchStart, )
Text change events (@TextChange)
Options menu (@OptionsMenu, @OptionItem, )
And many more.

4. DISCUSSION
4.1 Comparing Active Android and Android
Anotations with native approach
As stated before, both Android Annotations and Active
Android frameworks are used for reducing the amount
of code needed for implementing some functionalities in
our Android applications.
Android Annotations framework makes our code more
readable and easier to use and understand by replacing
(not removing) a lot of code that is either generated or

86

CASEmobile

necessary for the right implementation. A lot of Android


developers that use native approach agree that they
often find themselves losing quite a lot of time just for
setting up and preparing some functionalities.
As for the Active Android framework, not only does it
reduce the code needed for implementation, but it also
allows us to design our database using Object-Oriented
approach, without having to think a lot about modeling
the database itself.

4.2 Advantages and disadvantages


Using a framework in application development along
with benefits also brings a number of disadvantages and
limitations. Usually, the benefits are far above the limit,
and in most cases development frameworks are worth
using.
Using Active Android and Android Annotations
developers get a great set of advantages. Both
developmental frameworks are easy to use and
maintain, and perhaps one of the most important
benefits is the reduction of errors. It is widely known that
errors are mainly due to human factors, and by using
development frameworks the vast majority of the code is
automatically generated and developers are not obliged
to write these parts, which reduces the probability of one
of them to make a mistake.
Both development frameworks have a lot of influence
on the number of lines of code, and it goes in the
direction of Diet Driven Development. According to
some informations, using just Android Annotations in
average reduces the average number of lines of code
for 42%, and using Active Android gives even more
reduction[3]. Code written using a development
framework is in most cases more readable, and easier
to determine later why is some section of code used.
The disadvantages the developers face using
development frameworks are largely related to the
inability of customizing individual parts, while Active
Android and Android Annotations offer these
possibilities. These problems are eliminated by an open
source development framework that anyone can

customize to their liking. With all attempts to eliminate


drawbacks, there are still some that the community is
trying to solve, for example in Active Android function for
adding records to a table is void, and the only way to
check whether a record successfully entered or not
requires selecting the base immediately after entry.
Development frameworks are quite large, and it is not
easy to manage them while trying to customize.
Active Android as an ORM does support only the codefirst approach, so a base model (classes) can not be
made from tables[6].
Each development framework, including these two,
requires configuration and customization of a project to
their mode before it can be used at all, and to
inexperienced programmers it can add complications
with the development which leads to droping out the
development framework at the first step, the
configuration.

5. CONCLUSSION
This paper briefly summarizes the advantages and
disadvantages of using frameworks such as Android
Annotations and Active Android for native android
development. Android is a tremenduous platform, and
it's development is great. But, as allways, there is room
for improvement. While developing applications in a
standard way, developers often have to add or generate
relatively large ammounts of code to acomplish some
really trivial functionalities. But with usage of additional
frameworks, as shown in this paper, that code could be
easilly reduced and it's readibility improved, which is
often a very important factor.
To conclude this paper, we will add a quote from Robert
C. Martin to show how important clean and readible
code is:
The ratio of time spent reading [code] versus writing is
well over 10 to 1 [therefore] making it easy to read
makes it easier to write. [7]

References:
1

ActiveAndroid Guide, CodePath. [Online]. Available: http://guides.thecodepath.com/android/ActiveAndroidGuide#overview. [Accessed: 21-May-2014].

M. Pardo, Active Android source code, 21-May-2014. [Online]. Available: https://github.com/pardom/ActiveAndroid.

P.-Y. Ricau, Diet Driven Development, Devoxx. [Online]. Available:


http://www.devoxx.com/display/DV12/Android+DDD+(Diet+Driven+Development)! [Accessed: 16-May-2014].

AndroidAnnotations offical site, AndroidAnotaions. [Online]. Available: http://androidannotations.org/. [Accessed:


21-May-2014].

AndroidAnnotations source code, Github. [Online]. Available: https://github.com/excilys/androidannotations.


[Accessed: 21-May-2014].

. Plesac, Infinum Talks - Active Android. [Online]. Available: http://www.slideshare.net/Infinum/infinum-androidtalks-02-activeandroid. [Accessed: 21-May-2014].

R. C. Martin, Ed., Clean code: a handbook of agile software craftsmanship. Upper Saddle River, NJ: Prentice Hall,
2009.

Information on authors:
Alen Huskanovi
e-mail: ahuskano@foi.hr
Faculty of Organization and Informatics
Alen Huskanovi is a regular student of the third year of undergraduate study Information Systems at the Faculty of
Organization and Informatics in Varazdin. He has participated in various national and international competitions, among
which stands out IEEEmadC international competition for the design of mobile applications where he won first prize.

CASEmobile

87

Actively working on the system PEAS with whom he came to Croatian finals of Microsoft Imagine Cup. He is primarily
engaged in the development of applications for the Android operating system.
David Ante Macan
e-mail: amacan@foi.hr
Faculty of Organization and Informatics
David Ante Macan is a third year undergraduate student of Information Systems at Faculty of Organization and
Informatics. He has participated in various competitions, including the Croatian Microsoft Imagine Cup finals, won the best
design award at IEEEmadC contest, won the third place at Infinum student Hackathon 2014, etc. His main area of interest
is mobile development, especially Android. He is actively working on several projects, including the Personal Exam
Assistant (PEAS) project at Faculty of Organization and Informatics. He is also a member of IEEE Institute and is one of
the student coordinators and founders of the Laboratory for mobile technologies (MT Lab) at Faculty of Organization and
Informatics.

88

CASEmobile

CASEmobile

89

PRIMJENA I PREDNOSTI NOSQL BAZA PODATAKA


USING THE ADVANTAGES OF NOSQL DATABASES
Mario Novoselec, Denis Pavlovi, Milan Pavlovi

SAETAK:
Relacijske su baze danas temelj poslovanja velikog broja modernih organizacija. Tenja organizacija za skalabilnou
sustava i trend razvoja Web 2.0. aplikacija uvjetovali su razvoj NoSQL (Not only SQL) baza podataka. Drugi tip
motivacije ogleda se u agilnom pristupu razvoju s naglaskom na smanjenje kompleksnosti i poveanje brzine razvoja. S
obzirom na velike trokove u odreenim domenama implementacije relacijskih baza podataka, NoSQL baze podataka
nastoje smanjiti trokove odravanja skalabilnosti i pruiti jednostavna rjeenja za distribuciju i particioniranje modela
podataka. Ovaj e rad predstaviti danas najkoritenije tipove NoSQL baza podataka pozicionirajui ih direktno u okvire
primjene s naglaskom na direktnu usporedbu u konkretnoj domeni s relacijskim bazama podataka.

ABSTRACT:
Relational databases are one of the underlying parts of modern organizations. Need for system scalability and
development of Web 2.0. applications are one of the main drivers for NoSQL (Not only SQL) database rise. Another type
of motivation is represented by trend of agile development with emphasis on reducing complexity requirements and
increasing speed of application development. Considering higher costs in some areas of relational database system
implementation, NoSQL databases are trying to directly reduce costs of maintaining scalability and offer solutions for
effortless distribution and partitioning of data models. This paper will introduce the most used NoSQL database systems
by positioning them directly into the scope of usage with emphasis on direct comparison with relational databases.

1. INTRODUCTION
The NoSQL trend has appeared as a response to
massive cost of storing and manipulating data in
classical relational database systems. Another benefit of
NoSQL movement was flexibility of data modeling and
distribution. ''Relational databases provide a variety of
features and strict data consistency. But this rich feature
set and the ACID properties implemented by RDBMSs
might be more than necessary for particular applications
and use cases. As an example, Adobes ConnectNow
holds three copies of user session data; these replicas
do not neither have to undergo all consistency checks of
a relational database management systems nor do they
have to be persisted. Hence, it is fully sufficient to hold
them in memory.''[2] NoSQL systems share several key
characteristics. ''When compared to relational
databases, NoSQL systems are more scalable and
provide superior performance.[1]
With this approach, NoSQL databases are trying to
resolve some of the most common relational database
problems.
Since most of Web 2.0. applications are agile, NoSQL
databases tend to be very flexible as opposite to
relational databases. For instance, in most NoSQL
systems you do not have fixed database schema
structure and there is no need for forcing unique data
model. These types of data modeling are applicable to
applications that generate high amount of inconsistently
structured data (e.g. Web blogs, etc).
Jonathan Ellis from Rackspace defines three problems
of relational databases: [3]
1. Data scalability
2. Single server performance

3.

Strict schema design

This paper will describe main benefits and key concepts


of NoSQL databases with concrete examples in areas of
industry and science. Also, this paper will try to present
some of the NoSQL database downsides and their
affect to organizational and similar environments.

2. DATA MODELS
One of the main differentiation between relational and
NoSQL databases is the data model. Modern NoSQL
databases can be divided into three main categories.

2.1 Document Model


In this type of databases, data model is represented by
documents. Documents have JSON (JavaScript Object
Notation) like structure used for storing and traversing
through data.
In relational databases one record is scattered through
different columns, while in document data model one
record is represented with single document (object). In
that way, document data model provides an objectoriented approach to data representation.
Documents do not have strict schema structure and can
contain different type of fields. Every field can contain
different type of data such as date, binary, array or
string. This flexibility can be particularly helpful for
modelling unstructured and polymorphic data. It also
makes it easier to evolve an application during
development, such as adding new fields. Additionally,
document databases generally provide the query
robustness that developers have come to expect from

90

CASEmobile

relational databases. In particular, data can be queried


based on any fields in a document.''[1]
This paper will focus on one of the most popular
document database used today, MongoDB. According
to Mongo Inc. there is a wide variety of document
database usage, especially in science.
The European Organisation for Nuclear Research, also
known as CERN, is using MongoDB for solving problem
of storing high amount of differently structured data. ''At
this scale, the information discovery within a
heterogeneous, distributed environment becomes an
important ingredient of successful data analysis. The
data and associated meta-data are produced in variety
of forms and digital formats. However, users want to be
able to query different services and combine information
from these varied sources. However, this vast and
complex collection of data means they dont necessarily
know where to find the right information or have the
domain knowledge to extract this data.''[4]
The choice of NoSQL document model database was
logical in this example mainly because there is no rigid
data structure nor data persistency. Because data is not
structured equally and there is a need for fast searching
through big set of data, document model database can
support that kind of requirements in fast and flexible
way.

of that board. We term the board followers as implicit


followers (while the previous type of user-to-user
follower is an explicit follower).[7]
That kind of in-depth analysis of users behavior had
major requirements towards data caching for real-time
user analysis. Relational databases quickly reached
their limits because of graph caching specifics.
Caching the graph data is hard because the cache is
useful only if the entire subgraph of a user (vertex) is in
cache, however this can quickly result in an attempt to
cache the entire graph! [7]
Pinterest engineering team found solution in Redis
SortedSet data structure. SortedSet is data structure
very similar to standard set represented by binary-safe
string but with addition of operation to return items in
order. Pinterest used Redis for storing graphs which
were sharded by ID of a single user. Major
disadvantage was single threaded nature of Redis
database which was overridden by running multiple
instances of Redis on each CPU core.
By using Redis, Pinterest engineering team managed to
implement advanced graph structure for user analysis:

Main alternative to MongoDB as a leading document


oriented database, is a CouchDB which is a database
oriented towards Web applications. ''CouchDBs design
borrows heavily from web architecture and the concepts
of resources, methods, and representations. It
augments this with powerful ways to query, map,
combine, and filter data.[5]

2.2 Key-Value Model


The most basic type of NoSQL databases are key-value
stores. Every data instance has its own unique key
which is used to access associated value. These kind of
data structure is very similar to dictionaries found in
some higher programming languages.
This paper will briefly introduce one of the most
advanced key-value databases on the market called
Redis. Since most key value stores hold their dataset
in memory, they are oftentimes used for caching of
more time intensive SQL queries.''[2]
This paper will briefly show some example of key-value
model and some basic set of operations. In Redis, we
can specify our database insert by using SET
command:
SET user_role 'administrator'
Data insertion uses valid key-value syntax and allows
ease of access to any value in a data set:
GET user_role
One of the most important use case of Redis database
implementation is Pinterest, multinational social
network. One of the main characteristics of social
networks is ability to follow other users and their
interest. Pinterest tried to implement graph structure as
seen in Facebook or Twitter with millions of nodes
representing users.
For example, if Andrea follows Bob, shell follow all of
his boards, and if he creates a new board, shell
automatically follow that board. If Andrea follows Bobs
Recipes board, shell see all of his pins from that board
in her home feed. Andrea will also be listed as a follower

Figure 1: Pinterest graph structure for user analysis [7]


By moving away from relational databases, Pinterest
gained some advantages in scalabilty and efficiency of
existing infrastructure. In the end, when we migrated
away from the existing sharded MySQL cluster, we
saved about 30% IOps.

2.3 Column Oriented Databases


Column
oriented
NoSQL
databases
use
multidimensional sorted map as main structure for
storing data. In this kind of structure there is random
amount of key value pairs that can be stored in each
record. ''Each record can vary in the number of columns
that are stored, and columns can be nested inside other
columns called super columns. Columns can be
grouped together for access in column families, or
columns can be spread across multiple column
families.''[1]
Because of their column oriented structure, column
databases are very similar to relational databases. Main
advantage of NoSQL column databases are ability to
store data without fixed schema and reducing amount of
null values to minimum. If there is a data structure with
many different types of attributes, relational database
would have null value for every instance of data that is
not known. In column oriented database data would
simply be stored in one row if there is a need for it.
This paper will introduce Casandra as one of the most
used NoSQL column oriented databases. In Casandra

CASEmobile
data structure can be easily represented by group of
columns called column family:
CF= user_role
rowKey1 role
admin
rowKey2 role
user

permission
dateCreated
All
2012-1-11
permission
dateCreated
Basic
2013-11-13

Every row instance has unique identifying key. There is


also column based structure for storing data which can
be independent of fixed schema.
One of the most interesting case studies involving
Casandra was Bazaarvoice. Bazaarvoice is a service for
collecting user generated content and analyzing
information
gathered
through
different
media.
Bazaarvoices case was oriented towards cloud friendly
systems and ease of maintaining clustered database
systems. Next, we needed a database that allowed for
easy capacity expansion (especially write capacity) by
simply adding new machines online. Having multiple
data center support was also a very big deal, especially
where we can write to multiple data centers at the same
time.[9]
Main disadvantage of MySQL as a classical relational
database was impossibility to scale according to write
capacity growth. Bazaarvoice uses Casandra to store all
of customers metadata into single data catalog. That
means that every customer becomes single key with
different column structure depending on gathered
information.

91

measured the time required to complete a set number of


transactions as each transaction on its own is negligible.
For calculating the queries per second formulas on fig.
2. were used.

Figure 2. Metrics used in benchmark [12]


As they furthermore describe on p.12-13, database
schema used in benchmark was designed and modeled
to support a music application which would use different
algorithms to suggest songs to users according to their
tastes. The normalized schema was made for MySQL
database implementation and shown on fig. 2 . Due to
fact that MongoDB does not support complicated
operations such as JOINs, some compromises were
made. Final schema for MongoDB was showed on fig.
3. Details of queries (simple and complex), other
statements and configuration of both databases can be
found in [12], p. 15.-19. Every SQL statement had its
equivalent for MongoDB.

These kind of data structures can be optimized for quick


data access because of easy to maintain data structure.

2.4 Scaling NoSQL Databases


Most of NoSQL databases are used across multiple
systems to distribute large amount of data. NoSQL
databases like MongoDB are using sharding to control
process of partitioning data on multiple servers. A shard
can be easily described as one or more instance of
servers in a massive cluster used for distributing any
subset of data. The goal is to distribute data evenly
across multiple shards by redistributing them.
Relational databases (traditionally) reside on one
server, which can be scaled by adding more processors,
more memory and external storage. Relational database
residing on multiple servers usually uses replications to
keep database synchronization.''[11] NoSQL databases
are oriented towards cloud and multiple server
scalability with focus on ease of maintaining partioned
data. Data is transfered on multiple shards in range of
key-value pairs. Each shard is only responsible for a
specific range of data. Using this strategy, querying
certain data range can be done in a fast and efficient
way.
In order to maintan high performance of data access
over multiple shards, NoSQL databases can
compromise data integrity in a way that data can easily
be lost or overwritten.

3. SCALING ON CLOSED BENCHMARK


In work [12], some performance and scaling comparison
between RDBMS MySQL and NoSQL system MongoDB
was described. Authors of related work built the
benchmarking harness using C programming language
and latest stable drivers for each database system. As
they describe on p. 12., their benchmarking harness

Figure 3. MySQL schema used in benchmark [12]

Figure 4. MongoDB schema used in benchmark [12]


Authors in [12] made several conclusions about
implemented benchmark. MongoDB could handle more
complex queries faster because it worked with simpler
schema, but with the cost of data duplication. Despite
observed performance gain in complex queries, when
queries included nested SELECTs MySQL performed
best. In last type of complex query which contained two
JOINs and subquery, MongoDB had advantage over
MySQL due to Mongos use of subdocuments. This
advantage comes at the cost of data duplication which
causes an increase in the database size. If such queries
are typical in an application then it is important to
consider NoSQL databases as alternatives while taking

92

CASEmobile

in account the cost in storage and memory size resulting


from the larger database size. [12], p. 35-36.
Write operations were also considered in above
benchmark. MySQL performed better in data deletion
and authors of [12] claim this is logical because MySQL
performes better in simple search queries. Searching
and deletion are connected because deletion requires
finding the record to be deleted first. MongoDB
performed better in insertions. Both databases had a
linear trend in this test.
Mentioned authors also emphasized the use of different
configurations for nodes and threads. This part of the
benchmark required running the benchmarking harness
on 1, 2 and 3 nodes with multiple numbers of threads in
order to test how the databases performed with multiple
connections. [12], p 36. Although databases behaved
differently depending on the query complexity, at higher
numbers of connections the performance (queries per
second) appeared to converge.
Finally, they concluded that two databases behave
differently according to the type of queries, so the
choice of which database to use lies on the type of
application the system will be using. When using
MongoDB as database system, it is important to have
on mind that this database system results with
increased database size. Despite the indication that the
performance penalty on both databases is small
depending on the database size it is nonetheless an
important factor when considering the type of queries
which will be performed by applications [12], p 36.

4. NoSQL POSSIBILITIES ON MOBILE


PLATFORMS
Today, mobile applications have some specific and
common requirements about data persistence and
processing. Currently, mobile applications are one of the
most dynamic areas of Information Technology. In
similar way, demand for tablets and smartphones has
created a huge market for mobile applications
developed today. Also many Business Information
Systems/ Business Informatics undergraduate and
master programs introduced in their curriculum courses
related to mobile devices and applications[13].
Most of mobile applications today require a persistent
data layer, which is also one of the features of web
applications. Currently, mobile applications share quite
a few features of client -server web application
architecture, but there is one striking difference between
mobile and web application databases concerns. While
on one side web applications have a larger scale and
lots of resources on disposal, on the other hand mobile
applications have lesser scale and lesser resources on
their disposal (processing power) .
There had been huge amount of interest about NoSQL
data stores in last couple of years. Primarily NoSQL
data stores are used inside big web applications which
have needs for storing huge amounts of information
about user interactions and similar data. On the other
side as mobile platforms and hardware are being
developed, storage and performance of devices
powered with same platforms and hardware is rapidly
catching up desktop platforms. With that demand for
solutions like NoSQL databases on mobile devices is
increasing and currently used in some mobile
applications. Community of developers is trying to
embrace NoSQL on mobile platforms in a way of
creating special libraries for mobile NoSQL databases.

One of those is Android Couchbase library for using and


storing data into popular document NoSQL database
CouchDB. In that way, mobile application developers
can embed CouchDB database into their Android
application.

4.1 Querying NoSQL Databases


In classical SQL databases, schemas are composed of
one or more tables where each of the tables is
composed internally with fixed structure for table rows.
Opposing to tables, MongoDB database is composed of
collections in which each of the collections is composed
of one or more documents. Also each of those
documents that together create collections can have
completely different data structure. On SQL side there
are few options that cant be found inside MongoDB and
vice versa. For example, users could have roles and
roles could be referencing users while on MongoDB
side there wouldnt be any referencing between
collections. Both of databases support querying but in a
bit different ways. SQL databases support them in terms
of SQL queries. On the other side NoSQL database or
MongoDB in this case supports querying in terms of
built in functions. Each of these functions can be used to
manipulate data in different ways depending of the
context of data. One important notice about MongoDB in
this context is that it permits finding documents with no
value declared for an attribute[13]. Example for this
case is an region of one country, if its not declared it
wont be found, unless we explicitly specify the $exists
attribute. SQL databases do not have equivalent for this
query as such query couldnt be possible because of
sharing structure between all the rows in table. Problem
on the other side is that as queries become more and
more complicated MongoDB database shall extensively
use variables inside of one query. Disadvantage of
MongoDB query approach is that there are no
subqueries, but that problem can be solved via in
operator. Special operators for nesting queries
differentiate NoSQL approach and guarantee most of
SQL query possibilities.
db.roles.find({user:{$in:[admin,moderator]});

5. CONCLUSION
NoSQL trend is emerging as a valid relational database
alternative for specific use. It is very important to
analyse important aspects of different NoSQL data
models and include them in system requirements. As
mentioned, NoSQL databases behave different
according to size of data set and amount of operations
to execute. Flexible schema approach and functional
query structure manage to increase performance and
give effortless ways for data partitioning.
Relational SQL databases are focusing on rigid
structure with defined data types for storing data. In that
way, they are not suitable for use in environments that
are generating massive amounts of differently structured
data. With growth of Web 2.0. application usage there
are a lot of requirements for NoSQL databases.

CASEmobile

93

References:
1

MongoDB Inc., Top 5 Considerations When Evaluating NoSQL Databases, June 2013.

C. Strauch, NoSQL Databases, Stuttgart Media University, 2004, pp. 145.

J. McKEnna, NoSQL Ecosystem [Online]. Available: http://www.rackspace.com/blog/2009/11/09/nosql-ecosystem/.


[Accessed: 16-May-2014].

MongoDB Inc, CERN CMS [Online]. Available: http://www.mongodb.com/customers/cern-cms. [Accessed: 16-May2014].

The Apache Software Foundation, Why CouchDB? [Online]. Available:


http://docs.couchdb.org/en/latest/intro/why.html. [Accessed: 14-May-2014].

K.Seguin, The Little Redis Book, January 2012.

A. Khune, Building a follower model from scratch [Online]. Available:


http://engineering.pinterest.com/post/55272557617/building-a-follower-model-from-scratch [Accessed: 14-May2014].

NoSQL - Not only SQL [Online]. Available: http://scriptandscroll.com/2011/08/21/nosql-not-only-sql-introduction-toapache-cassandra/ [Accessed: 16-May-2014].

Planet Casandra Inc., Bazaarvoice Chooses Casandra over MySQL, HBasa and MongoDB to Power Content
Analytics Platform [Online]. Available: http://planetcassandra.org/blog/post/bazzarvoice-chooses-cassandra-overmysql-hbase-and-mongodb-to-power-content-analytics-platform/ [Accessed: 16-May-2014].

10

K.Chodorov, Scaling MongoDB, O'Reilly Media New York, 2011.

11

J. Pokorny, NoSQL databases: a step to database scalability in web environment, Charles University, Praha, 2013.

12

C. Hadjigeorgiou, RDBMS vs NoSQL: Performance and Scaling Comparison, The University of Edinburgh, August
2013.

13

M. Fotache, D. Cogean, NoSQL and SQL Databases for Mobile Applications. Case Study: MongoDB versus
PostgreSQL, University of Iasi, Romania, February 2013.

Information on authors:
Mario Novoselec
e-mail: mnovosel2@foi.hr
Faculty of Organization and Informatics
Mario Novoselec is a third year full time undergraduate student at Faculty of Organization and Informatics, University of
Zagreb. He is one of the initial members of FOI MT Lab. His main interests are focused towards developing Web
applications with emphasis on user experience and modern design. He has also been involved in various non-commercial
projects.
Denis Pavlovi
e-mail: dpavlovi@foi.hr
Faculty of Organization and Informatics
Denis Pavlovi is a third year full time undergraduate student at Faculty of Organization and Informatics, University of
Zagreb. He is also one of the initial members of FOI MT Lab. He is interested in modern web application design and
development. He is involved in various non-commecial projects.
Milan Pavlovi
e-mail: mpavlovi2@foi.hr
Faculty of Organization and Informatics
Milan Pavlovi is a third year full time undergraduate student at Faculty of Organization and Informatics, University of
Zagreb. He is also one of initial member of FOI MT Lab. His main interests are Information Systems engineering and
development. He is also interested in Java desktop, mobile and web application development and technology.

94

CASEmobile

CASEmobile

95

SOFTVER ZA MOBILNE UREAJE U JAVNOM PRIJEVOZU

Samir Rizvi, Barbara Rudi, Ivan Pogari

SAETAK:
U ovom radu definirana su glavna podruja kljuna za funkcioniranje softvera za mobilne ureaje u javnom
prijevozu i analizirana je mogunost porasta uslune kvalitete u putnikom prijevozu sa stajalita elemenata
koji ine inteligentne transportne sustave implementirane u vozila javnog prijevoza. Poseban naglasak
stavljen je na odreena podruja, bitna za realizaciju takvih tehnologija, odnosno usluga. Kao polazna
toka istraivanja, uz internet koji slui kao osnova za funkcioniranje i spajanje softvera, koriteni su ureaji
koji su potrebni za realizaciju praeni detaljnim opisom aplikacije koja moe sluiti u tu svrhu. Upravo ta
aplikacija predloena je kao bitan imbenik, te je prezentiran nain na koji svi ti gore navedeni elementi
mogu funkcionirati zajedno. Ostala podruja koja su takoer obraena su: zadovoljstvo putnika, vea
kvaliteta usluge, implementiranje inteligentnih sustava u javni prijevoz i prezentiranje istih korisnicima
javnog prijevoza, usklaivanje funkcija softvera, internet i vozila u javnom prijevozu putnika na nain na koji
e se zadovoljiti potrebe putnika, prijevoznika i okolia.

SUMMARY:
This paper tries to define main areas, crucial for functioning of mobile phones software in the public
transport and analyses the possible increase of service quality in the public travelers transport from the
standpoint of elements comprising the intelligent transportation systems implemented in the public transport
vehicles. Special emphasis was given to the specific areas, relevant for the realization of such technologies
that is services. Appliances required for realization of such services were used as the starting point of
research alongside the Internet that serves as basis for functioning and connecting software, followed by
detailed overview of applications which can be used for the same purpose. As an important element a
proposition for designing applicative software uniting all the above described areas was proposed, thus
presenting the way all these elements can function together. Other areas of interest that were discussed
are: travelers satisfaction, higher quality of service, implementing the intelligent systems in the public
transport and presenting them to the public transport users, harmonizing the operations of software,
Internet and vehicles in the public travelers transport in ways that will concurrently fulfill needs of travelers,
carriers and the environment.

1. UVOD
Javni prijevoz je jedna od primarnih zadaa kod
rastereenja gradskih prometnica. Jednako tako, ako je
dobro organiziran, moe pridonijeti znaajnom
smanjenju emisije CO2 plinova u atmosferu. Osim toga,
jedan od glavnih ciljeva Europske unije jest odrivi
promet i sniavanje emisije CO2 i ouvanje okolia na
nain da se rasterete gradske prometnice a teite sa
cestovnog prometa se prebaci na ostale grane prometa
kao to je npr. eljezniki promet. Poveanje prometa
kroz poveani rast broja vozila na prometnicama
rezultira zagaenjem okolia, atmosfere, postepenim
nestankom neobnovljivih izvora energije, zagaenjem
pitkih voda, globalnim zatopljenjem. Vaniji efekti su
tetni uinci na ljude, biljne i ivotinjske vrste to
rezultira istrebljenjem pojedinih vrsta. Meutim, zbog
neznanja, neupuenosti ili manjka dobre volje, ljudi i
dalje koriste osobna vozila kao svakodnevni nain
prijevoza. Na taj nain u velikoj mjeri tete prirodi ali i
samima sebi. Stoga se namee glavno pitanje: kako
ljude navesti da ponu vie koristiti neki oblik javnog
prijevoza?

Evidentna je injenica da su ljudi sve vie okrenuti


uporabi raznih tehnologija do te mjere da se danas
esto govori i o ovisnosti. Broj pametnih telefona,
tableta i prijenosnih raunala uvelike je porastao, a
njihova uporaba se vrlo esto kree u granicama
nekontroliranog konzumerizma. Meutim, koriste li se
za zabavu, posao ili kao oblik komunikacije oni su
postali neizostavnim dijelom ljudske svakodnevice.
Svaki od takvih ureaja za svoje potpuno iskoritavanje
i namjenu zahtijeva pristup internetu uz presumpciju
potrebne telekomunikacijske infrastrukture. Danas je
ve veliki broj operatera koji pruaju takve usluge, a
neki gradovi imaju pokrivenost besplatnim beinim
internetom. Takoer, velika veina korisnika koristi
takve ureaje uz stalnu konekciju na Internet. U takvim
okolnostima prostor za nova idejna rjeenja, koje se
mogu implementirati u takve ureaje, je velik.
Populacija koja koristi takve ureaje su uglavnom osobe
mlae i srednje ivotne dobi, tj. velika veina onih koji bi
mogli postati potencijalni korisnici javnog prijevoza, a
koji to trenutno nisu. Razvoj kvalitetnog informacijskog
sustava u javnom gradskom prijevozu ini se loginim
potezom, a njegova implementacija bi trebala privui,

96

CASEmobile

ali i zadovoljiti, upravo takve korisnike. Mogunost


primjene aplikativnog softvera tijekom prijevoza,
obavljanja poslovnih dogovora ili same zabave privukla
bi panju najvee potencijalne skupine korisnika takvih
usluga. Osim toga, informatizacijom javnog prijevoza
olakano je plaanje usluga to je takoer vano
svojstvo. Ekoloki momenti poput smanjenja buke i
posljedino smanjenja stresa izazvanog kretanjem
velikog broja vozila su korisne posljedice smanjenja
uporabe
osobnih
vozila.
Dakle,
kvalitetnom
informatizacijom sustava javnog gradskog prijevoza
otvara se mogunost zamijene osobnih vozila javnim
prijevozom na svakodnevnoj bazi. Uz
navedena
svojstva evidentni su i prinosi zajednici i okoliu ali i na
osobnom nivou kroz smanjenje osobnih trokova.
Rad je koncentriran na prijedlog izrade softvera
potrebnog za integriranu uporabu informacija i podataka
u urbanoj sredini na primjeru Grada Rijeke.

2. POTREBA ZA JAVNIM GRADSKIM


PRIJEVOZOM
Jedan od najveih problema suvremenih gradova,
posebno velikih gradova, je promet. Od uspjenosti
rjeavanja toga problema ne zavisi samo cirkuliranje
ljudi i roba, nego i ukupna kvaliteta ivota u gradu.
Veina suvremenih gradova kronino je optereena
zastojima u ulinom prometu, bukom, oneienim
zrakom, nedostatkom mjesta za parkiranje i konfliktom
pjeaka i motornih vozila. S druge strane, javni gradski
prijevoznici svakodnevno se susreu sa stalnim padom
broja korisnika svojih usluga.
Razlog za takvo stanje je osobni automobil, ne zbog
toga to je on osnovni uzronik problema, ve stoga to
se njime, u neprihvatljivo velikoj mjeri, pokuava rijeiti
prometna potranja. Porast ivotnog standarda, tenja
za sve veom pokretljivou, udobnost i slino dovode
do sve vee upotrebe osobnog automobila. Automobil,
kao sredstvo koje je svojim prisustvom najvie
pridonijelo prometnoj problematici dananjih gradova,
odavno je postao element prestia. Njegova
atraktivnost, bez obzira na pratee probleme,
neprekidno raste. Iako postaje u napuenim gradovima
relativno sporiji, sve je udobniji, sigurniji, suvremeniji,
intenzivnije se troi i ee kupuje.
Gradovi u kojima je, slijedom razliitih okolnosti
upotreba osobnih vozila reducirana, a javni prijevoz
podignut na viu razinu kvalitete, imaju bitno manje
problema u gradskom prometu uz znatno viu ukupnu
kvalitetu ivota. Jedini razuman nain za usklaivanje
individualnih elja i kolektivne volje, koncepti koji su u
osnovi kontradiktorni, jest osiguranje usluge javnog
prijevoza najvie mogue kvalitete tako da se sugerira
velikom broj stanovnika da odustanu od koritenja
osobnog vozila i isprobaju mogunosti koje im nudi javni
prijevoz.
Bitno svojstvo javnog prijevoza je sadrano u injenici
da prijevoznici stavljaju na javnu upotrebu prijevozne
kapacitete svim potencijalnim korisnicima prometnih
usluga. Obavljanje prijevoza je registrirana trajna
djelatnost/usluga koju prijevoznik obavlja, uz adekvatnu
naknadu, u obliku stalnog zanimanja. Tipian primjer
takvog prijevoza je upravo javni gradski prijevoz putnika
(JGPP) koji djeluje u sloenom gradskom prostoru i iji
je zadatak da povee udaljenije prostore i razne
sadraje te tako ostvari njihovo funkcionalno jedinstvo.
Porastom broja stanovnika grad prostorno raste i
umnoavaju se njegove funkcije pa se samim tim

komplicira zadaa JGPP. Danas se ivot u gradovima


ne moe niti zamisliti bez sustava JGPP.
Javni gradski prijevoz putnika je organizirani oblik
prevoenju velikog broja stanovnika/putnika unutar
gradskog teritorija po ustaljenim trasama i redovima
vonje, a njegova je opa karakteristika da ga pod
odreenim propisanim uvjetima moe koristiti svaki
graanin. Prigradski prijevoz putnika, koji povezuje
prigradska naselja u gravitacijskom podruju grada sa
uim gradskim podrujem, ima istu funkciju kao i javni
gradski prijevoz na uem gradskom podruju. U
mnogim sluajevima te dvije vrste prijevoza se
meusobno nadopunjuju i predstavljaju jedinstveni
sustav prijevoza putnika koji slui prvenstveno dnevnim
migrantima da dou do svoga cilja: posao, kola,
rekreacija i dr.(Trbui, 2006., 2.)
Za normalan ivot grada javni gradski putniki prijevoz
je neophodan kao i opskrba elektrinom energijom,
vodom i slino. Izmeu razvoja gradova i JGPP oduvijek
je postojala interakcijska povezanost. Zbog znaaja za
ivot grada, javni gradski putniki prijevoz je u svim
gradovima u svijetu pod veom ili manjom
kompetencijom gradske ili dravne vlasti.
Orijentacija na putnika ili korisnika usluga, briga o
njegovom zadovoljstvu je osnovni problem u JGPP. Cilj
svake tvrtke je postizanje uspjeha u poslovanju. Uspjeh
koji se iskazuje u znaajem udjela na tritu, u
prepoznatljivom
i
prihvaenom
proizvodu/usluzi,
dokazanoj kvaliteti proizvoda/usluge i sustava
organizacije i, naravno, u imidu firme koji iz svega toga
proizlazi. Kvaliteta kao subjektivna kategorija podlona
je razliitim shvaanjima i kriterijima. Ovisna je o sredini
u kojoj netko ivi, navikama i mijenja se tijekom
vremena. Ono to je kvalitetno za jednu osobu nije za
drugu, a osim toga, ono to zadovoljava putnika u
pogledu kvalitete danas, sutra ve moe biti potpuno
neprihvatljivo. Kvaliteta nije stanje kojeg ljudi ele stii,
ve staza koja vodi prema konstantnom unaprjeenju
usluge. Smisao kvalitete jest poveati zadovoljstvo
korisnika tako da se zadri njihova privrenost i uini ih
se stalnim korisnicima usluga. Za putnika je kvaliteta
usluge sve. Dosadanji pristupi tom pitanju, koji istiu
samo pojedine aspekte kvalitete putnike usluge kao to
su: tonost, sigurnost, frekvencija i neke druge kriterije,
previdjeli su to osnovno oekivanje korisnika. Na
podruju JGPP, kao i na bilo kojem drugom podruju,
kvaliteta mora biti zastupljena u svim dimenzijama
usluge koja se nudi.
U prijevozu putnika kvaliteta poinje sa sigurnou i
pouzdanou-odgovornou, nastavlja se s nuenjem
usluge u skladu s oekivanjima korisnika i kompletna je
jedino ako se usluga pobolja do nivoa osobnog
kontakta izmeu osoblja i korisnika/putnika odnosno
partnerstva. Ovi razliiti aspekti kvalitete ne natjeu se
meusobno, ve zajedno doprinose kvaliteti kako ju
doivljavaju putnici. Pristup poboljanju kvalitete ne
moe se uvesti bez da se zna kakva su oekivanja
korisnika/putnika na tom podruju. Ne utopijske
predstave o kvaliteti, o emu moda mataju izvan
specifinog konteksta, niti suprotnost kvaliteti, na koju
korisnici/putnici objektivno mogu naii na svom
slijedeem putovanju, ve usluga koju putnik smatra
legitimnom i normalnom. Izraz ove oekivane kvalitete
znai da svi akteri moraju vidjeti uslugu oima korisnika.
eljena kvaliteta predstavlja ambicije lokalne uprave i
prijevoznika na podruju usluge, dozvoljavajui
korisnicima oekivanja i, istovremeno, strategijske
izbore uesnika. eljena kvaliteta se izraava kao

CASEmobile
oekivani rezultat za korisnika usluge. To je obeanje
dano sa strane prijevoznika sa namjerom da se usluga
osigura. Postignuta kvaliteta je rezultat poteza koje su
poduzeli sudjelujui partneri (prijevoznici, gradska
uprava i dr..). Razlika izmeu opaene i postignute
kvalitete omoguava da se ocijeni zadovoljstvo
korisnika, to je najvaniji pokazatelj uspjenosti
aktivnosti na podruju poboljanja usluge.
Osnovna komponenta djelovanja je, dakle, detaljna
definicija kvalitete koju oekuje putnik i izraenost iste u
obliku rezultata za klijente. Oekivana kvaliteta
omoguava razvoj metoda i partnerstva za poboljanje
kvalitete kao i ocjenu uspjenosti sustava.
Korist ovakvog pristupa je ta da obuhvaa sve razine
odgovornosti i izvedbe usluge. Na primjer, osoblje na
odreenoj liniji, na nekoj stanici ili smjeni, ili u
inspekcijskom timu, formirati e i koristiti istu metodu na
toj razini prijevoza, osiguravajui tako potpunu
dosljednost.
Prihvaeni pokazatelj kvalitete i uspjenosti poduzea je
zadovoljstvo korisnika/putnika. Zadovoljan putnik je
lojalan putnik i prijevoznik mora uiniti sve da svoje
potencijalne korisnike usluge uini stvarnim korisnicima,
a svoje trenutne korisnike stalnim korisnicima.
Zadovoljan putnik je besplatna reklama prijevoznika i
manje je osjetljiv na pojavu poremeaja u prijevozu.
Zadovoljan korisnik govori o svome zadovoljstvu
nekolicini, dok e nezadovoljan korisnik o svome
nezadovoljstvu govoriti puno veem broju ljudi.
Pri ocjenjivanju zadovoljstva putnika treba stalno voditi
rauna o nekoliko parametara:
zadovoljstvo je dinamian proces, koji se stalno
mijenja, s obzirom na stupanj zadovoljenja
zahtijeva, na promjene u oekivanjima, na
promjene u subjektivnom i objektivnom okruenju
putnika
ne postoji univerzalno, ope zadovoljstvo putnika,
nego je to mnoina pojedinanih zadovoljstava koje
tek svojim ukupnim djelovanjem daju zadovoljstvo
putnika kao pojedinca. Zadovoljstvo putnika (kao
grupe) je prosjek pojedinanih oekivanja i emocija
zadovoljstvo je relativan pojam. Lojalnost korisnika
ne moe se zadrati ak ni zadovoljstvom koje
osjea. Naputati znaju i zadovoljni korisnici.

3. KRATKI OSVRT
Inteligentni transportni sustav (ITS) je upravljaka i
informatiko-komunikacijska
nadogradnja
(ili
nadgradnja) klasinog prometnog i transportnog
sustava, tako to se postie bitno vea propusnost,
sigurnost, zatienost i ekoloka prihvatljivost u odnosu
na rjeenja bez ITS aplikacija. (Bonjak, 2008., 161.) To
znai da se kroz stvarno vremensko prikupljanje i
obradu podataka te umreenu distribuciju informacija
postie znatno smanjenje zaguenja, ekanja,
prometnih nesrea, neuinkovitosti prijevoza, ekolokih
oneienja itd.
Atribut inteligentni openito oznaava sposobnost
adaptivnog djelovanja u promjenjivim uvjetima i
situacijama, pri emu je potrebno prikupiti dovoljno
podataka i obraditi ih u stvarnom vremenu. Koncept
inteligentnih informacijskih sustava (IIS) blizak je
informatiarima kao i razliite napredne tehnike koje su
zajednike IIS-u i ITS-u. Koncepti i tehnike umjetne
inteligencije (AI tj. Artificial Intelligence) - prepoznavanje
oblika, strojno uenje, inteligentno izraunavanje itd.,

97

koriste se u dizajniranju, razvoju i implementaciji


razliitih ITS aplikacija.
Stanovnik europskog grada izgubi prosjeno jednu
godinu ivota u dodatnim ekanjima zbog prometnih
zaguenja i neposjedovanja aurnih informacija o
odvijanju prometa. Problemi gradova i davatelja usluga
u javnom prijevozu takvi su da je klasini pristup nuno
zamijeniti pristupom inteligentnih transportnih sustava
pri rjeavanju pitanja kvalitete usluge, sigurnosti i
oneienja okolia. ITS rjeenja ukljuuju redizajn
prometne infrastrukture s novim prometnim rjeenjima
organizacije i voenja tokova, inteligentnim navoenjem
na rute s manjim optereenjem, informiranjem o
slobodnim parkirnim mjestima, daljinskim praenjem
tereta i vozila, telematskom naplatom cestarine,
upravljanjem incidentnim situacijama u prometu itd.
Moemo rei da ITS predstavlja: napredni koncept
rjeavanja prometnih problema, znanstvenu disciplinu,
skup tehnologija i novi tehnoloki pokret. To dokazuju
programi i projekti ITS-a u svim razvijenim zemljama,
uspostavljanje ITS-a kao akademske discipline i
studijskog programa na sveuilitima, te uspjeno
djelovanje niza nacionalnih i meunarodnih ITS udruga
(ITS Croatia osnovana 12. listopada 2005). Za razliku
od izoliranih tehnikih rjeenja (zeleni val, promjenjivi
znakovi, telematiki ureaji u vozilima) koncept ITS-a
predstavlja sustav sustava, kako je to objanjeno u
naprednim prirunicima (Highway Capacity Manual,
Intelligent Transport Primer itd.).
Uvjerljivi razlozi za ITS slijede iz poraznih podataka o
sigurnosti i eksternim trokovima odvijanja prometa.
Prema podacima organizacije WHO, preko 1,2 milijuna
ljudi svake godine smrtno strada u prometu, a 50
milijuna biva ozlijeeno. Ukupni izravni i eksterni
trokovi prometnih nesrea iznose 3 do 4 % bruto BDPa pojedinih zemalja.

4. PODRUJA ISKORISTIVOSTI
INTELIGENTNIH TRANSPORTNIH
SUSTAVA
Meunarodna organizacija za normizaciju ISO
definirala je 11 domena ITS-a:
1. informiranje putnika (Traveler Information)
2. upravljanje prometom i operacijama
(Traffic Management and Operations)
3. vozila (Vehicles)
4. prijevoz tereta (Freight Transport)
5. javni prijevoz (Public Transport)
6. urne slune (Emergency)
7. elektronika plaanja vezana uz transport
(Transport Related Electronic Payment)
8. sigurnost osoba u cestovnom prijevozu
(Road Transport Related Personal Safety)
9. nadzor vremenskih uvjeta i okolia
(Weather and Environmental Monitoring)
10. upravljanje odzivom na velike nesree
(Disaster Response Management and Coordination)
11. nacionalna sigurnost (National Security)
U skladu s temom rada bitno je usredotoiti se na
odreena podruja usluga. U podruju usluga
informiranja putnika (traveller information) obuhvaene
su statike i dinamike informacije o prometnoj mrei,
usluge predputnog i putnog informiranja, te podrka
slubama koje obavljaju prikupljanje, pohranjivanje i

98

CASEmobile

upravljanje informacijama za planiranje transportnih


aktivnosti.
Usluga predputnog informiranja (pre-trip information)
omoguuje korisnicima da iz doma, odnosno sa svog
radnog mjesta ili druge javne lokacije dou do korisnih
informacija o raspoloivim opcijama, vremenu ili
cijenama putovanja. Naglasak je na multimodalnim i
intermodalnim informacijama.
Putno informiranje (on-trip information) ukljuuje
stvarnovremenske informacije o putovanju, procjenu
vremena putovanja ovisno o postojeim uvjetima,
raspoloivosti parkirnih mjesta, prometnim nezgodama
itd.
Informacije se pruaju putem terminala na autobusnim i
eljeznikim postajama, trgovima, tranzitnim tokama,
ekranima u vozilu ili prenosivim osobnim terminalima.
Usluge rutnog vodia i navigacije mogu se odnositi na
predputno i putno informiranje o optimalnoj ruti ili putanji
do naznaenog odredita. Izbor najbolje rute temelji se
na informacijama o prometnoj mrei i javnom prijevozu
te ukljuuje multimodalne opcije s rjeenjima kao to su
Park & Ride i druga.
Primjeri tih usluga su:
dinamiki rutni vodi u vozilu (Dynamic In-vehicle
Route Guidance)
integrirani multimodalni putni vodi
pjeaki ili biciklistiki rutni vodi.
Podrka planiranju putovanja (Trip Planning Support)
prua podatke o prometnim tokovima i transportnoj
potranji u svrhu transportnog planiranja. To su aktualni
i povijesni podaci iz prometnih upravljakih i
informacijskih sustava, te podaci od vozila u pokretu
(Probe Vehicles).
U ITS podruju pod nazivom vozila (Vehicles) nalazi se
vie usluga kojima se poboljava operativna sigurnost
vozila:
poboljanje vidljivosti (Vision Enhancement)
asistencija vozau i automatske radnje vozila
spreavanje sudara
sigurnosna upozorenja itd.
U podruju javnog prijevoza (Public Transport)
definirano je vie usluga koje omoguuju redovite i
uinkovite radnje javnog prijevoza uz pruanje aurnih
informacija korisnicima.
Primjeri tih usluga su:
napredni sustav javnog prijevoza
praenje voznog parka
napredni sustavi dispeinga
zajedniki transport (Shared Transport)
U podruju elektronika plaanja vezana uz transport
nalaze se usluge:
elektronika naplata javnog prijevoza
elektronika naplata cestarine
elektronika naplata parkiranja
daljinska plaanja itd.
Integracija razliitih sustava plaanja i institucija
ukljuenih u sustav obuhvaa tehniko-tehnoloka i
meuorganizacijska rjeenja. (Bonjak, 2006., 25.)
Spreavanje zaguenja i adaptivno voenje toka vozila
predstavlja jedan od najznaajnijih podruja primjene
ITS aplikacija. Za efektivno i uinkovito voenje
prometnog toka potrebno je dublje poznavanje
relevantnih veliina, te naina prikupljanja i obrade
stvarnovremenskih podataka kako bi se razliitim
oblicima distribucije informacija djelovalo na tok.

Produbljeno poznavanje teorije prometnog toka i


temeljnih naela voenja sloenih sustava kljuno je za
razvoj brojnih ITS aplikacija, kako na autocestama, tako
i na drugim dijelovima prometnog sustava. Opetovano
zaguenje nastaje u oekivanim jutarnjim ili
popodnevnim vrnim satima, odnosno u predvidivim
intervalima vikendom. Kljuna upravljaka akcija
(unaprijedno voenje) jest informiranje i savjetovanje
putnika i vozaa neposredno prije nastajanja vrnih
optereenja, odnosno preusmjeravanje prometa na
druge, manje optereene prometnice. (Bonjak, 2009.,
9.)
U osnovne funkcije raunalno podranog sustava
nadzora i upravljanja poduzea pripadaju:
utvrivanje lokacije vozila
usporedba zadanog i stvarnog stanja u prometu
radi nadzora voznog reda
automatska
razmjena
informacija
putem
podatkovne radio komunikacije
upravljanje govornom komunikacijom
kontinuirano informiranje dispeera o aktualnom
stanju radnog procesa
prikaz radne situacije u grafikom i tablinom obliku
usporedba zadanog/stvarnog stanja radi nadzora
tura (usporedba zadanog/stvarnog uinka)
alati za pomo dispeeru kod organizacijskih
dispozicijskih mjera (upravljanje smetnjama)
nadzor posebnih dogaaja
protokoliranje svih vanih informacija i zahvata
osiguranje alata za dijagnozu (npr. analiza voznih
podataka)
nadzor veza i osiguranje veza
informacija za putnike u stvarnom vremenu (DFI)
utjecaj na svjetlosnu signalizaciju
Koritenjem mogunosti ITS sustava te integracijom s
cjelovitim prometnim rjeenjima ITS-a na podruju
urbane sredine prometno poduzee ostvaruje sljedee
ciljeve:
Poveanje atraktivnosti javnog prometa kao i
prihvaanja javnog prometa od strane putnika na
osnovi obiljeja kakvoe, kao to su pouzdanost,
raspoloivost i jednostavno rukovanje putem:
postizanja maksimalne tonosti i redovitosti
poboljanja sigurnosti veza kod presjedanja
skraivanja vremena prijevoza mogunou
utjecaja na svjetlosnu signalizaciju
bolja informiranost putnika na stajalitima putem
stvarnih podataka, kao i davanje informacija u
vizualnom i akustinom obliku.
Pojednostavljenje
radnih
procesa
i
poveanje
efikasnosti i ekonominosti za prijevoznika moe se
postii:
optimizacijom koritenja vozila i osoblja
optimizacijom vremena prometovanja vozila
(vrijeme obrta)
ranim
prepoznavanjem
radnih
i
tehnikih
nepravilnosti i smetnji
uinkovitim radom osoblja u centrali
poveanom fleksibilnou na temelju mogunosti
da se vozilo koristi prema potrebi.
Primjena ICT-a, telematike i ITS tehnologije omoguuje
da prijevoz putnika funkcionira bolje, efikasnije i
omoguuje poveanje alternativnih tipova usluge. U
konanici, organizacija omoguuje ekonomski efikasniji
sustav. to se tie putnika, ITS omoguuje veu
atraktivnost sustava prijevoza putnika koja pomae da
se putnici lake odlue na putovanje javnim gradskim
prijevozom.

CASEmobile

99

5. PARK & RIDE SUSTAV U FUNKCIJI


JAVNOG GRADSKOG PRIJEVOZA
Cilj Park & Ride sustava je smanjenje prometnih guvi,
odnosno broja osobnih vozila na prometnicama i
parkiralitima u samom sreditu grada. Sutina je
sustava da se korisniku (vozau i/ili putniku) ponudi
mogunost jednostavnijeg odlaska u gradsko sredite
koritenjem sredstva javnog prijevoza umjesto
individualnog automobila. (Generalni urbanistiki plan
Grada Rijeke, 2001.)
U svijetu i u Europi primjenjuju se najee dvije
osnovne varijante Park & Ride sustava:
Odreeni Park & Ride terminali sa prateim
sadrajima i parkiranjem pod naplatom, koja
ukljuuje cijenu karte javnog gradskog prijevoza;
Otvorene ili zatvorene parkiraline povrine,
ureene uz terminale javnog gradskog prijevoza
bez naplate parkiranja.
Budui da sam Park & Ride sustav slui kao nadopuna,
odnosno poboljanje javnog gradskog prijevoza putnika,
moe biti olakan koritenjem i kombinacijom istog
aplikativnog softvera, kao to je ve i integriran na
parkiralinim prostorima. Oito je da se pravilnim
planiranjem gradske prometnice daju rasteretiti i privui
novi korisnici. Takoer, dodavanje dodatnih funkcija
unutar aplikativnog softvera ne bi trebao predstavljati
vei problem pa se umjesto sustava naplate za
parkiralini prostor, odnosno za javni prijevoz sve moe
povezati unutar jedne aplikacije ime bi se svime
olakalo koritenje i povealo zadovoljstvo samim
koritenjem aplikacije. Isto tako, dobio bi se uvid o
slobodnim parkiralinim mjestima na pojedinim
terminalima kako ne bi dolazilo do guve i postojala bi
mogunost za rezervacijom parkirnog mjesta (izvedivo
pomou stupia, posebnog kljua, asistencijom
zaposlenika, itd.) na krai period, odnosno pretplatom.

Slika 1. Primjer Park & Ride sustava


(Izvor: thexrt.blogspot.com, 24.4.2014.)

6. SPECIJALIZIRANOST APLIKATIVNOG
SOFTVERA
Neka je za potrebe ovog rada aplikativni softver
definiran kao skup programa koji imaju specijaliziranu
namjenu, kao to je obrada teksta, slike, zvuka, dizajn i
upravljanje bazama podataka, izrada web stranica itd.
(Leme, 2006., 1)
Specijaliziranost aplikativnog softvera se ogleda u
njegovoj namjeni odreenoj prema vrsti korisnika.
Jednako tako svaki specijalizirani softver treba biti
prilagoen irem spektru korisnika. Zbog toga se
inzistira na njegovoj jednostavnosti pri uporabi. Obino
se aplikativni softver moe kupiti na tritu kao gotov
proizvod ili se moe naruiti njegova izrada ili ga u
krajnjem sluaju korisnik moe izraditi sam. Trite
mobilnih aplikacija je brzo rastue te je izrada aplikacija
za mobilne platforme logian izbor tvrtkama koje ele
ponuditi i prilagoditi svoje servise za mobilne platforme.
Prije svega, ovo proizlazi iz toga to dananje mobilne
platforme nude vrhunski user-experience i lokacijski
neovisan pristup do informacija putem brzih 3G/4G
mrea. Nije zanemariva niti marketinka vrijednost koju
donose mobilne aplikacije za tvrtke koje odlue nuditi
svoje servise putem mobilnih platformi. Distribucija
mobilnih aplikacija obino je centralizirana te ih korisnici
preuzimaju ili kupuju putem internetskih trgovina.(slika
2)

Slika 2. Apple-ov Appstore - virtualna trgovina aplikacijama (Izvor: www.apple.com)

100

CASEmobile

7. UPOTREBA APLIKATIVNOG SOFTVERA


Najvanije pitanje mobilne strategije jedne tvrtke jest da
li uope napraviti posebnu aplikaciju za mobilne
ureaje. Neke tvrtke uistinu ne trebaju aplikaciju za
mobilne ureaje ali zato trebaju svoje stranice uiniti
lako itljivima na malim ekranima mobilnih ureaja. No,
ako web stranice imaju dobru posjeenost mobilnih
korisnika, javlja se drugo pitanje: Treba li izdati
aplikaciju za mobilne ureaje?
Trenutno, nije potrebno previe promiljati ve izdati
aplikaciju za mobilne platforme. Istraivanje koje je
proveo guru upotrebljivosti Jakob Nielsen jasno
pokazuje da se korisnici puno lake i bre snalaze
aplikacijama nego s mobilnim verzijama web stranica.
Desktop/pune web stranice koje se prikazuju na
mobilnim ureajima ipak zadaju najvie glavobolje
korisnicima mobilnih ureaja, odnosno pametnih
telefona. (Vukovac, 2012., 89)
Aplikacije za mobilne ureaje su puno jednostavnije za
koritenje od mobilnih stranica zato jer je na mobilnim
stranicama mogue postii tek djelomino zadovoljenje
potreba i u veini sluajeva radi se u samom procesu
dizajna web stranice. Aplikacija s druge strane moe
ciljati na specifina ogranienja i mogunosti svakog
pojedinog ureaja, naglaava prednosti i umanjuje
ogranienja svakog ureaja. to je mobilni ureaj slabiji
to je potrebno uloiti vie u optimizaciju same aplikacije.
Mogunost mikro plaanja ili plaanja unutar aplikacije
(In App Purchase) dodatna je mogunost na koju se
nikako ne smije zaboraviti.
Trokovi razvoja mobilne aplikacije vremenom e se
poveavati, prvenstveno zato jer e biti vie platformi za
razvoj, vie specifinih ureaja za koje e se trebati
aplikacija razvijati. Kao minimum, aplikacija e morati
podravati iOS, Android i Windows Phone. Nadalje,
mnoge od tih platformi vjerojatno e se podijeliti na vie
podplatformi koje zahtijevaju razliite aplikacije za
pristojnu korisniku upotrebljivost, ovdje prvenstveno
mislimo na cijeli ekosustav Androida. Nije ovdje imun
niti Apple-ov iOS. Sam iOS podijelio se na ekosustav

iPhone-a/iPod-a i iPad-a. Iako slubeno je to jo uvijek


jedan, isti iOS, za aplikaciju potrebno je dizajnirati
posebno suelje za iPhone/iPod i iPad (ne uzimajui u
obzir razluivost ekrana unutar svakog od ova dva
ekosustava). Dakle, realno je za oekivati daljinu
diverzifikaciju mobilnih ureaja (pametnih telefona i
tableta) u budunosti.
S druge strane, izrada web stranice prilagoene web
preglednicima mobilnih ureaja je puno jednostavnija i
jeftinija, kako danas, tako i u budunosti. Pripremiti web
stranicu potrebno je tek za tri formata, za pametne
telefone, "male" tablete sa (oko) sedam innim
ekranima kao to su Galaxy Tab 7, 7.7 ili Kindle Fire, te
za velike tablete kao to su iPad ili Samsungovu liniju
velikih tableta. Dok su razlike dizajna suelja za tablete
malena, priprema dizajna za pametne telefone koji su
ispod 5 ina zahtjeva ipak malo vie pripreme i
preinaka.(slika 3)
Pametni telefoni i tablet ureaji u posljednje vrijeme u
velikom su zamahu, te doslovno preplavljuju trite
mobilnih telekomunikacija i ureaja. Njihova popularnost
i broj korisnika raste iz dana u dan, te su sasvim
opravdane prognoze kako e se u skoroj budunosti
otvoriti vie web stranica za mobilne ureaje nego za
raunala. Paralelno s tim jo vie e porasti potranja za
specijaliziranim mobilnim aplikacijama. Ve danas
mobilne aplikacije predstavljaju imbenik koji je najvie
pridonio naglom porastu trita pametnih telefona i
glavni su nositelj mobilne revolucije.
Sve vei broj korisnika ima pametne mobilne telefone,
koji zahvaljujui velikom zaslonu i brzom procesoru
mogu biti raunala u malom. Za njih se razvijaju
posebne aplikacije, prilagoene karakteristikama i
gabaritima tih ureaja, koje mogu biti vrlo atraktivne i
korisne. Trite takvih aplikacija je u strelovitom porastu,
a marketinke i ine koristi od izdavanja vlastite aplikacije
za telefon su viestruke.
Izrada web stranica i aplikacija za mobilne ureaje
neto je kompliciranija od izrade klasinih verzija za
raunala. Danas na tritu postoji veliki broj razliitih

Slika 3. Usporedba mobilne i obine web stranice uitane na mobilnom ureaju


(Izvor: www.bluefountainmedia.com)

CASEmobile
pametnih telefona koji koriste razliite operativne
sustave i preglednike za surfanje internetom, pa sadraj
treba prilagoditi posebno za svaki od njih. Sljedea
vana karakteristika je to su mobilni ureaji daleko
manji od monitora raunala, pa sadraj treba optimalno
smjestiti na manje ekrane, a osim toga i same veliine
ekrana variraju od ureaja do ureaja.

101

kojih se nalaze opcije koje moemo odabrati. Te


kategorije su:
Pokazni kupon ( popoularno. pokaz)
Odabir autobusne linije
Vozni red
Postavke

8. PRIJEDLOG IZRADE APLIKATIVNOG


SOFTVERA ZA MOBILNE UREAJE U
JAVNOM PRIJEVOZU PRIMJER
GRADA RIJEKE
Izrada aplikacije za javni prijevoz bila bi od velike koristi
za sve sudionike u prometu, izravne i neizravne na
nain da bi privukla korisnike i ujedno im olakala
koritenje usluge. Autoprijevoznik bi na taj nain dobio
vei broj korisnika i znatno vei broj izravnih povratnih
informacija ime bi mogao poboljati svoju uslugu. Drugi
je razlog smanjenje broja osobnih vozila na cestama i
posljedino smanjuje buka i zagaenje okolia.
injenica je da velik broj ljudi koristi pametne telefone i
tablete a u skladu s tim i razne drutvene mree na
kojima se takva usluga moe promovirati, kao i duani
za aplikacije na samim ureajima koje koriste. Jedan od
naina je i u vidu besplatne vonje samom registracijom
unutar aplikacije ali i kupnjom standardnih pokaznih
kupona na kojima bi bio kod koji bi korisnik mogao
jednokratno unijeti u aplikaciju i iskoristiti ga za
besplatnu vonju.
Takoer, nakon kupnje pokaza unutar aplikacije, isti bi
se mogao koristiti i bez da je ureaj stalno spojen na
internet ime bi sama usluga bila mnogo funkcionalnija i
pogodnija za koritenje svim korisnicima.

Slika 4. Poetno suelje aplikativnog softvera (Izvor:


Izradio autor)
Poetni zaslon aplikacije sadravao bi osnovne funkcije
koje bi bile dostupne u svakom trenutku prilikom
upotrebe aplikacije unutar bilo kojeg prozora. To su
osnovne funkcije i slue kao glavne kategorije unutar

Slika 5. Izgled suelja funkcija dnevnog i mjesenog


pokaza u aplikativnom softveru (Izvor: Izradio autor)

102

CASEmobile

Glavna funkcija bi omoguavala koritenje pokaznog


kupona na nain da bi korisnik kupnjom istog dobio sve
podatke izravno na ekran, bez potrebe za koritenjem
standardnih naina pokaza a kontrolor bi mogao
provjeriti valjanost skeniranjem qr koda koji bi zauzimao
najvie prostora na ekranu kako bi u svakom trenutku
bio lako dostupan i jednostavan za uitavanje.
Kategorije unutar funkcije pokaznog kupona su
sljedee:
Dnevni pokaz
Mjeseni pokaz
Ostalo (poludnevni, obiteljski, godinji,
umirovljeniki i ostale vrste pokaza)
Svi podaci vezani uz istek pokaza bili bi vidljivi u obliku
brojanog odbrojavanja, a pokaz bi se jednostavno
mogao obnoviti pritiskom na funkciju obnovi koja bi
bila povezana s korisnikim raunom u kojem bi ve
unaprijed bio definiran nain plaanja pa ne bi bilo
potrebe za ponovnim unosom informacija vezanih uz
nain i vrstu plaanja. Mjeseni i ostale vrste pokaza
razlikovali bi se po tome to bi koristili i sliku, te osobne
podatke za jednostavniju kontrolu. Unutar funkcije
postavke suelja bilo bi omogueno izabrati koji nain
pokaza e se pojaviti kao primarni kako korisnik koji
uestalo koristi aplikaciju ne bi morao iznova odabirati
eljenu funkciju koju najee koristi. Unutar funkcije
obavijesti korisnik bi dobivao informacije o skorom
isteku pokaza i nainu obnove. Kao i na standardnom
fizikom dnevnom, mjesenom i ostalim vrstama pokaza
pozadina bi sluila kao mjesto gdje bi se mogle nalaziti
sponzorske reklame u vidu slika ili pokretnih animacija,
a u sluaju vie sponzorskih reklama bile bi regulirane
veliinom i duljinom trajanja prikaza.

Slika 6. Izgled suelja funkcija odabira linije i relacije u


aplikativnom softveru (Izvor: Izradio autor)
Odabir autobusne linije korisniku bi sluio kao vodi ili
kao mjesto informiranja o odreenoj liniji ili relaciji kojom
se kree ili koju namjerava koristiti. Postojala bi dva
naina koritenja:
Odabir linije
Odabir relacije
Odabir linije sluio bi korisnicima koji unaprijed znaju
koju autobusnu liniju ele koristiti i na taj nain
jednostavno mogu odabrati eljenu liniju koja e
automatskim putem biti predloena ulaskom u autobus.
S druge strane, odabir relacije je opcija koja bi bila od
velike koristi korisnicima koji nisu upoznati s kretanjem
linija a htjeli bi na jednostavan, brz i siguran nain doi
do eljene lokacije. To bi im bilo omogueno upisom
mjesta polazita i mjesta odredita ili automatskim
odabirom trenutne lokacije i upisom mjesta odredita.
Nakon to bi odabrali lokacije bila bi im ponuena
najbra ili najkraa relacija, ukljuujui kretanje samo
jednom linijom ili kombinacijom vie linija s
presjedanjima.

CASEmobile

103

odabirom opcije koritenja trenutne lokacije mogao bi u


realnom vremenu pratiti kretanje autobusa i pratiti
udaljenost do sljedee stanice, kao i vrijeme potrebno
do pristizanja autobusa na sljedeu stanicu. Bio bi
omoguen odabir obine, satelitske ili kombinirane karte
a postojala bi i mogunost prikaza vanijih lokacija ili
dogaanja uz rutu kretanja.

Slika 7. Izgled suelja funkcija popisa stanica i odabira


rute u aplikativnom softveru (Izvor: Izradio autor)
Nakon to je linija odabrana umjesto ikonice autobusa
pojavljuje se ikonica s brojem linije a opcije odabira linije
i relacije zamijenjene su opcijama:
Popis stanica
Ruta kretanja
Opcija popis stanica sadravala bi popis svih stanica
na odabranoj liniji s mogunou slobodnog pregleda
stanica ili s mogunou odabira trenutne lokacije ime
bi se stanice automatski izmjenjivale kretanjem
autobusa a sve to bilo bi popraeno i s praenjem
udaljenosti do sljedee stanice i prikazom vremena
potrebnog za pristizanja autobusa na sljedeu stanicu.
Koristei rutu kretanja korisnik bi u svakom trenutku
mogao pregledati rutu po kojoj se autobus kree a

Slika 8. Izgled suelja funkcija odabira gradskih linija i


mree linija u aplikativnom softveru (Izvor: Izradio autor)

104

CASEmobile

Sljedea funkcija dostupna korisniku je vozni red.


Vozni red omoguava korisnicima, najee prigradskih
linija, da u bilo kojem trenutku imaju dostupnu
informaciju o vremenu pristizanja autobusa. Funkcije
koje sadri su:
Gradske linije
Prigradske linije
Mrea linija

trenutku bi se mogao odjaviti s ureaja kojeg trenutno


koristi.

Osim standardnog prikaza voznih redova za gradske i


prigradske linije postojala bi i mogunost uvoenja
voznog reda i za none linije. Mrea linija bila bi prikaz
svih linija na podruju grada, grafiki ucrtanih na mapu
sa nazivima stajalita i rutom kretanja svih linija
oznaenih razliitim bojama radi lakeg snalaenja na
karti. Time bi se postigao pristupaan, jednostavan i
pregledan nain informiranja korisnika o autobusnim
linijama, dijelovima grada koje pojedine linije povezuju i
mogunosti presjedanja.

Budui da velika veina ljudi svakodnevno koristi


drutvene mree, bili bi u mogunosti povezati raune
ime bi mogli na jednostavniji nain, odnosno
automatski unijeti osobne podatke, ali i dijeliti rute,
obavijesti i bodove s drugima.

U postavkama suelja korisnik bi bio u mogunosti


odabrati sam izgled i boju suelja, boju i veliinu fonta
(bitno za osobe s problemima u vidu), ukljuiti i iskljuiti
zvuk prilikom dodira odreenih funkcija, odabrati to e
mu biti poetni ekran prilikom ulaska u aplikaciju i odabir
linije koja e biti primarna.

Bodovi su kategorija koja bi u suradnji s


autoprijevoznikom i sponzorima omoguila stimulaciju
putnika na ee koritenje javnog prijevoza u vidu
bodova kojima bi se mogle kupovati karte, razne
ulaznice te bi imali mnoge pogodnosti, slino kao u
aviokompanijama gdje koriste nagradne milje.
Obavijesti su jedna od vrlo bitnih stavki a omoguile bi
upozoravanje korisnika o prispijeu autobusa na
autobusnu stanicu u odreenom vremenskom periodu,
trenutku kada je potrebno izai iz busa (korisno za
turiste), mogunosti osvajanja bodova, dogaanjima na
lokaciji u neposrednoj blizini rute po kojoj se korisnik u
autobusu kree, kanjenjima, guvama na cesti,
trenutnoj lokaciji autobusa, itd. Takoer bi korisnici u
bilo kojem trenutku mogli kontaktirati autoprijevoznika,
iznijeti svoja miljenja o usluzi, trenutnoj vonji,
vozaima, stanju na cesti, guvama, kanjenju i mnogim
drugim stavkama za koje smatraju da su bitne ili
korisne. Primljene informacije autoprijevoznik moe
dijeliti sa svojim korisnicima i na taj nain bi se
poboljala usluga koju pruaju ali bi se i omoguilo da
svi sudjeluju i skupa tu uslugu uine boljom, sigurnijom i
udobnijom.

9. ZAKLJUAK
Javni gradski prijevoz osmiljen je kao nain prijevoza
koji e rasteretiti gradska sredita, povezati razliite
dijelove grada i pridonijeti sigurnosti u prometu. Na
mnogo naina se nastoji poboljati javni prijevoz, bilo
novim prijevoznim sredstvima ili poboljanjem kvalitete
usluge ime se nastoji privui to vei broj ljudi. Isto
tako korisnici usluga takoer trae to pristupaniju
uslugu uz visok stupanj informatizacije sustava.
Slika 9. Izgled suelja postavki u aplikativnom softveru
(Izvor: Izradio autor)
Opcija postavke sluila bi za promjenu svih korisnikih
podataka, kao i za promjenu postavki suelja i
komunikaciju s autoprijevoznikom ali i drugim
korisnicima putem drutvenih mrea. Kategorije unutar
postavki su sljedee:
Postavke korisnikog profila
Postavke aplikativnog suelja
Povezivanje rauna
Bodovi
Obavijesti
Kontakti
Postavke korisnikog profila gdje bi bilo omogueno
mijenjati osobne podatke, naine plaanja i izmjenu
fotografija. Svaki korisnik bi imao personalizirano
suelje prijavom na bilo kojem ureaju i u svakom

Stanovnik europskog grada izgubi prosjeno jednu


godinu ivota u dodatnim ekanjima zbog prometnih
zaguenja i neposjedovanja aurnih informacija o
odvijanju prometa. Problemi gradova i davatelja usluga
u javnom prijevozu takvi su da je klasini pristup nuno
zamijeniti pristupom inteligentnih transportnih sustava
pri rjeavanju pitanja kvalitete usluge, sigurnosti i
oneienja okolia.
Primjene informacijsko komunikacijske tehnologije u
sustavu
javnoga
gradskog
prijevoza
putnika,
mnogostruke su, te postaju kljuna u logistikom smislu
upravljanja uslugama javnoga gradskog prijevoza
putnika.
Danas u Zagrebu postoji naplata karata u vozilima
javnog gradskog prijevoza putnika putem mobilnog
telefona, to Zagreb stavlja sam vrh razvijenih gradova
svijeta u primjeni ICT tehnologije. Pravilnom primjenom
bi se trebao smanjiti broj neplaenih karata, potreba da
se ima sitan novac i manipulacija s njime, te

CASEmobile
pojednostavljena primjena naplate voznih karata, kako
za korisnika tako i za prijevoznika.
Primjena takve tehnologije omoguuje da prijevoz
putnika funkcionira bolje, efikasnije i omoguuje
poveanje alternativnih tipova usluge. Konano,
organizacija omoguuje ekonomski efikasniji sustav.
to se tie putnika, takav sustav omoguuje veu
atraktivnost sustava prijevoza putnika koja pomae da
se putnici lake odlue na putovanje javnim gradskim
prijevozom.

105

Izrada kvalitetne aplikacije za javni prijevoz bila bi od


velike koristi za sve sudionike u prometu, izravne i
neizravne na nain da bi privukla korisnike i ujedno im
olakala koritenje usluge, autoprijevoznik bi na taj
nain dobio vei broj korisnika i znatno vei broj izravnih
povratnih informacija ime bi mogao poboljati svoju
uslugu, dok bi svima ostalima bila od koristi budui da
se smanjenjem broja osobnih vozila na cestama
smanjuje buka i zagaenje okolia.

Literatura:
1

Downey, D. F. et al, Ion Implantation Technology, Prentice-Hall (New York, 1993), pp. 65-67. [A book reference]

Wasserman, Y, Integrated Single-Wafer RP Solutions for 0.25-micron Technologies, IEEE Trans-CPMT-A, Vol.17,
No. 3 (1995), pp. 346-351. [A reference to a journal article ]

Shu, William K., PBGA Wire Bonding Development, Proc 46th Electronic Components and Technology Conf,
Orlando, FL, May. 1996, pp. 219-225. [A reference to a presentation at a Conference]

Institut graevinarstva Hrvatske d.d., Poslovni centar Rijeka: Generalni urbanistiki plan Grada Rijeke, prometni dio,
knjiga 1, Rijeka, 2001.

thexrt.blogspot.com, 24.4.2014

www.apple.com

www.bluefountainmedia.com

Podaci o autorima:
Samir Rizvi, bacc.ing.traff

e-mail: srizvic@veleri.hr,
Barbara Rudi, vii predava

e-mail: barbara.rudic@veleri.hr
Doc. dr.sc. Pogari Ivan

e-mail: pogarcic@veleri.hr
Profesor visoke kole na Veleuilitu u Rijeci
Voditelj studija informatike pri Veleuilitu u Rijeci
Veleuilite u Rijeci, Trpimirova 2,
+385 51 32 13 00

e-mail: ured@veleri.hr
http:/www.veleri.hr

106

CASEmobile

CASEmobile

107

SUSTAV PREPOZNAVANJA SLIKOVNIH UZORAKA MOBILNIM UREAJEM


IMAGE PATTERN RECOGNITION USING MOBILE DEVICES
Alen Huskanovi, David Ante Macan, Zoran Antolovi, Boris Toma, Marko Mija

SAETAK:
Prepoznavanje slikovnih uzoraka se do sada obavljalo iskljuivo koristei ili sloena i skupa programska rjeenja i
ureaje (optike itae). Mobilni ureaji razvili su se do mjere u kojoj ih je mogue iskoristiti za takve obrade, ali algoritmi
i sustavi koji to rade u realnom vremenu su rijetki. Ovaj rad opisuje razvoj algoritma u sklopu PEAS sustava, kojim je
omogueno prepoznavanje uzoraka na listi za odgovore (eng. scorecard) koristei mobilne ureaje. Pri tome emo
prikazati teorijske osnove prepoznavanja slikovnih uzoraka, implementaciju algoritma pomou OpenCV i JavaCV
biblioteka te praktina iskustva u takvom pristupu.

ABSTRACT:
Image pattern recognition has been so far carried out almost exclusively using sophisticated and expensive software
solutions and devices. Mobile devices have evolved to the extent that they can be used for such purpose, but the
algorithms and systems that provide such functionalities in real time are rare. This paper describes the development of
an algorithm within PEAS system, which enables the identification of answers in scorecard paper sheet using mobile
devices. Thereby we will show the theoretical basis of the image pattern recognition, implementation of the algorithm
using the OpenCV library and JavaCV, and the practical experience in such an approach.

1. INTRODUCTION
Today, image processing has found use in many
aspects of ICT technologies. But, until recently, this task
was mainly reserved for desktop computers,
workstations, server computers, due to its high
hardware requirements. However hardware and
software capabilities of todays mobile device are
increasing rapidly, which among other things results in
image processing becoming more and more available
on those devices as well. Since the mobile devices are
compact and highly portable, new possibilities are
opening from many aspects, including the image
processing one. Such possibilities include computer
vision, virtual reality, augmented reality, pattern
recognition etc., finding its application in entertainment
industry, health, security, government, biometrics,
tourism, education...
One of the possibilities for utilizing image processing is
its application in overall educational process. This paper
shows the attempt to utilize mobile devices and image
processing capabilities to improve evaluation process in
education, as a part of PEAS (Personal Exam
Assistant) project. PEAS tries to automate and speed
up the process of exam evaluation in educational
institutions, thereby realizing benefits for both teacher
and students. A significant part of PEAS system is a
mobile application whose role is to take a picture of
scorecard sheet, identify the marked answers and send
them to server system for evaluation.
The central issue in this mobile part of PEAS system
was the identification of marked answers on scorecard
sheet in native mobile application. In order to achieve
this functionality, we aimed to develop algorithm for
distinctive marked rectangle detection from the mixed
grid of marked and unmarked rectangles.

Although used for the reason stated above, this


algorithm can easily be modified for recognition of
various different image pattern types.
The algorithm itself is fragmented into several smaller
partial problems which we managed to surpass
successfully. Such partial problems are: contour and
edge detection, corner calculation, perspective
correction, shadow removal, answer identification,
answer marking on the picture itself...
As previously mentioned, todays mobile devices have
the capacity for such processing tasks, as well as the
cameras of enough quality level, so that the images
could be easily fetched from the devices camera and
instantly prepared for further processing.
In order to ease the implementation of algorithm we
identified several image processing frameworks that
could be used, such as: openCV, imageJ, FastCV etc.
For this algorithm, we used some of the functionalities
provided by the openCV framework through its java
wrapper (javaCV).
In chapter two the basics of image processing are
covered. Also a brief comparison of available image
processing frameworks is presented, and a more
detailed description of openCV framework is given.
Chapter three contains detailed description of
recognition algorithm itself, along with its subsets and
issues. In chapter four results and implemented
algorithm is discussed and compared with other
possible solutions. At last, final chapter (five) concludes
the subject, states the advantages and disadvantages of
the presented work, and suggests possible topics for
further research.

108

CASEmobile

2. DIGITAL IMAGE PROCESSING AND


DATA EXTRACTION ON MOBILE
PLATFORMS
2.1 Basic concepts
Digital image processing is a term describing usage of
computer algorithms on digital images in order to
achieve certain goal, such as color correction,
perspective modification, distortion etc., by modifying
binary source data. Digital image is an image f(x,y) that
has been discretized both in spatial coordinates and in
brightness. Its represented by a 2D integer array, or a
series of 2D arrays, one for each color band. The
digitized brightness value is called grey level [1]. Each
pixel of image represents part of an object, which has
been illuminated during the image capturing process.
Illuminating light has been partly absorbed and partly
reflected, causing different color representation.
Reflected light reaches camera sensors and is being
recognized. Each digitalized pixel is holding information
about each color channel (e.g. in RGB color system,
each pixel holds information about red, green and blue
channel, which combined result in final color of that
pixel). Additionally, each pixel can carry information
about fourth, alpha channel, which is used for defining
image transparency settings.
Image processing is still mostly used in industry,
entertainment and marketing (e.g. [2], [3], [4]), image
and video editing software (e.g. [5]), and, still in very
small percentage, education [6]. Its important to
emphasize usage of digital image processing in
biometrics, especially in face recognition, age and
gender estimation and other fields. Open source
biometric Recognition project OpenBR is developing
communal biometrics framework supporting the
development of open algorithms and reproducible
evaluations, on top of the OpenCV library [7]. Image
processing is key element of modern video surveillance
(e.g. [8]), real time traffic monitoring (e.g. [9]) and
drowning detection systems (e.g. [10]), but also some of
software that help people with disabilities (e.g. Camera
Mouse by Boston College [11]). Data extracting from
images also is field of utilization digital image
processing, as it is process of recognizing patterns in
images and creating digital data out of them such as
vectors and/or arrays. For example, if bingo card is
scanned and processed to discover marked numbers,
data about this card is being extracted and digitalized
using digital image processing. Similarly, in this paper,
process of data extraction by using digital image
processing of exam scorecards will be presented.
Process will be broken in three parts: Cropping image to
fit area of scorecard answers, perspective correction as
preparation for evaluation algorithm and evaluation
algorithm itself.

2.2 Image processing frameworks


Image processing is available feature of many
programming languages (Python, Java, MATLAB ),
but powerful and fast processing is mostly done in C++.
While one can choose to write program from scratch,
many libraries and frameworks are available with
precisely developed functions for different processing
tasks. There are several popular libraries that offer
functionalities for computer vision and image
processing. A brief comparison of such libraries is given
in Table 1.

Sinha [12] conducted performance comparison between


3 image processing frameworks: OpenCV, LTI and VXL.
The results presented in Figure 1 show that OpenCV is
faster than LTI and VXL, especially if used with Intel
Performance Primitives. Comparison has been taken on
Pentium M 1.7GHz and four tests were done:
2D DFT: Forward fourier transform of a 512512
image
Resize: 512512 to a 384384 image, bilinear
interpolation. An 8-bit, 3 channeled image was used
Optical flow: 520 points were tracked with a 4141
window and 4 pyramid levels
Neural net: the mushroom benchmark of FANN
Library

Written Language
in
support

OpenCV
[13]

C++

Java
(JavaCV),
.NET
(EmguCV),
Python,
MATLAB,
C++,
C

C++

C++

N/A

Flash

FastCV
[16]

N/A

C++

LTI-Lib
[17]

C++

C++

VXL
[18]

C++

C++

Aforge
[19]

C#

C#

CImg
[14]
Ccv
[15]

OS support

License

Windows,
Android,
Maemo,
FreeBSD,
OpenBSD, iOS,
BlackBerry 10,
Linux, OS X

BSD

Linux, Solaris,
CeCILL
OS X
license
Linux, OS X,
LGPL
Windows
Windows,
OS X, Linux,
FastCV
Android,
License
Windows Phone Agreement
8
GNU Lesser
Linux, Windows
General
Public
Windows, Linux,
VXL License
Solaris
Windows,
Windows Phone

LGPL v3

Table 1 Listing of available image processing libraries.


Supported OS for mobile devices are bolded

Figure 2 OpenCV vs VXL vs LTI: Performance


comparison (less is better) [12]

2.3 OpenCV library


One of the most popular and widespread libraries
certainly is OpenCV (Open Source Computer Vision
Library), an open source computer vision and machine
learning software library, built to provide a common
infrastructure for computer vision applications and to
accelerate the use of machine perception in the
commercial projects [13].
Library itself has more than 2500 optimized algorithms,
including comprehensive set of both classic and state-

CASEmobile
of-the-art computer vision and machine learning
algorithms. These algorithms can be used to detect and
recognize faces, identify objects, classify human actions
in videos, track camera movements, track moving
objects, extract 3D models of objects, produce 3D point
clouds from stereo cameras, stitch images together to
produce a high resolution image of an entire scene, find
similar images from an image database, remove red
eyes from images taken using flash, follow eye
movements, recognize scenery and establish markers
to overlay it with augmented reality, etc.
OpenCV is written natively in C++, but it has several
wrappers which expose OpenCV functions in different
languages and different platforms. Some of them are
EmguCV for .NET C#, JavaCV for Java, OpenCV for
Android SDK etc. OpenCV is very large open source
project, with more than 13.000 commits on GitHub,
committed by more than 200 contributors. Except
individual contributors, Corporate contributors such as
Intel Inc. and Google Inc. are also involved in OpenCV
development [20].
There are several reasons why we decided to use
OpenCV:
Support for mobile platforms only OpenCV,
FastCV and Aforge explicitly state support for
mobile operating systems, while only OpenCV and
FastCV support Android.
Licensing OpenCV has more liberal licensing
policy (BSD) than FastCV (FastCV License
Agreement).
Community: OpenCV has significantly larger
communit with more than 47 000 community users
and over 7 000 000 downloads.
Contributors: OpenCV is actively maintained by
more than 200 contributors, both individuals and
companies.
After weve selected OpenCV, it was then a matter of
choice wether we will use OpenCV with C++ (Android
NDK) or with Java (JavaCV wrapper). We have chosen
JavaCV mainly because it was much easier to configure
the whole project to work with JavaCV, and the syntax
was more familiar to us, since Java is used for Android
development.

3. ALGORITHM

109

is started. The last step is to evaluate the color of


detected squares, and to see if it can be considered as
marked square.
The following table lists and describes the most
important OpenCV functions and functions developed
by us:
Name

cvFindContours

Description
int cvFindContours(CvArr*
image, CvMemStorage*
storage, CvSeq**
first_contour, int
header_size, int mode, int
method, CvPoint offset)

Source

Open CV

The function retrieves


contours from the binary
image

getPerspectiveTrans
form

cvWarpPerspective

Mat
getPerspectiveTransform(In
putArray src, InputArray dst)
Open CV
Calculates a perspective
transform from four pairs of
the corresponding points
Void
cvWarpPerspective(const
CvArr* src, CvArr* dst, const
CvMat* map_matrix, int
flags, CvScalar fillval)

Open CV

Applies a perspective
transformation to an image

getLinesFromImage

List<Line>
getLinesFromImage(IplImag
e src, int cannyTreshold);

Our

Retrieves the list of lines


detected on the image

getCornerPoints

3.1 Problem description

List<Point>
getCornerPoints(IplImage
src,List<Line> lines, double
minTreshold)

Ours

Retrieves the list of four


corner points from top left to
bottom left one

In this section we will describe the algorithm developed


as a part of the PEAS (Personal Exam Assistant)
system. The implementation targets Android mobile
platform, so we decided to utilize popular OpenCV
image processing framework through Java wrapper
(JavaCV).
The main goal of this algorithm is to detect the handmarked answers on scorecard paper sheet. Scorecard
sheet itself contains arbitrary number of initially unfilled
square fields which represent possible answers to
particular questions. User is required to fill (mark) by
hand those square fields which according to him
represent correct answers. Such completed scorecard is
an input to our algorithm.

getAverageColor

In order to detect marked answers on scorecard, user


takes a picture of it using its phone camera. Now, the
first issue that appears here is the possibility the picture
is not taken from proper undesirable perspective, so
perspective must be corrected (Figure 2) and the image
prepared. After that, the square fields detection process

analyzeArea

int
getAverageColor(IplImage
img, int x, int y, int width, int
height, int padding)

Ours

Retrieves the RGB value of


average color in forwarded
region
boolean
analyzeArea(CvRect rect,
IplImage img, int
thresholdTrue)

Ours

Retrieves the true if the


answer is marked or false if
answer is not marked.

Table 2 Main functions used to implement algorithm

110

CASEmobile

3.2 Perspective correction algorithm

3.3 Algorithm for detecting question squares

Since the answer detection algorithm needs answer


square fields to be mapped in a grid, it may be
necessary first to correct the image's perspective in
order to put the grid back in normal position, as shown
in Figure 2.

The input for this part of the algorithm is the image of


the cropped frame, reduced to a fixed width and height.
Coordinate (0,0) representing the upper-left corner of
the frame with the answers is known. Since the image is
always the same size, we know exact distance from left
and upper edge of the frame to first square field, i.e. we
know the exact lengths of a and b. Also the width and
height of the square are fixed, so the entire area of the
first square can be calculated.

Figure 3 Perspective correction


The whole perspective-correction process can be
divided in few steps:
1
Contour detection
2
Frame recognition
3
Corner calculation
4
Corner position detection
5
Perspective transformation
After the image was grayscaled, first we have used
openCV's function 'cvFindContours' to get all of the
contours in the image. The function usually finds large
number of contours, depending on the image size and
complexity. But the biggest contour in the image is the
frame which contains answers grid. Then it is simply a
matter of getting the contour with biggest calculated
area.
After the frame has been found, we crop the image for
easier handling (fewer pixels to worry about). And then
we try to detect the lines on the frame. We also have to
specify minimum length in pixels for object to be
considered as a line. We use minimum of 200 pixels.
After the lines get detected, in order to get the frame
corners, it is necessary to calculate line intersections
and sort them by their coordinates to know which corner
belongs to which side.

Figure 5
Two more values are required: the distance from the
upper-left corner of one square to upper-left corner of
the first square to the right c, and the distance from the
upper-corner of one square to upper-corner of the first
square below d. Using aforementioned values, the exact
positions and areas of all square fields are calculated.
Once all square fields are known we simply iterate
through questions and answers and check whether the
square representing an answer is marked or not. A
simple pseudo-code representation of the algorithm is
stated below:
FOR each question
averagecolor=getAverageColor
FOR each answer
isMarked=analyzeArea(area,averageColor)
if isMarked is true
answer is marked
else
answer is not marked

3.4 Algorithm for recognizing answers


Input to the algorithm is a rectangle object containing all
square fields (answers) in one row (question). As
mentioned before, square position is calculated
relatively to the starting edge of base rectangle. At the
beginning, average color of all squares is calculated, so
it can easily be determined if square is marked (i.e.
color is darker than average color of base rectangle) or
not.

Figure 4 Perspective correction process steps


Furthermore, the only remaining thing is to insert the
original image and its frame corners as parameters for
the openCV functions 'getPerspectiveTransform' and
'cvWarpPerspective', and we get the transformed image
as a result.

Figure 5 visualizes conceptual steps of detecting


marked answers. True problem is not to detect white
and black squares, because there are no absolutely
black or white ones. Trick is to determine darker and
lighter squares, in comparison to average color of
common area of all squares. We could use average
color of entire scorecard, but shadows significantly
affect detection, so localization of detection improves
results. In step 1, safety padding is added, to ensure
that average color will take enough white color in
detection (if all squares are marked, average color will

CASEmobile
be dark, and detection wont be so efficient). In second
step, average color is calculated, and compared with
each square in step three.

Figure 6 Steps for detecting marked answers

111

be found at BitBucket*. Precondition for usage is


obtaining the exam metadata by scanning QR code at
the beginning of the exam. Information used in square
detection algorithm is available in that metadata. Once
exam is finished, user captures scorecard with PEAS
application and photo (i.e. digital image) processing
begins.
After processing is done, recognized answers are
displayed as overlay layer with green squares over the
detected answers. User then checks marked answers
and confirms that green marked square fields really are
chosen answers. After validation, answer data is sent in
HTTP request to web service which calculates the final
score. Response contains data about exam result which
is then shown in styled form of radial graph.

Function getAverageColor
Input: Area to analyze, padding
Include padding into area
avgValue = 0
FOR each pixel in area
curValue = RGB value of current pixel
avgValue = avgValue + curValue
counter = counter + 1
avgValue = avgValue / count
return avgValue
Function analyzeArea
Input:
Area to analyze, threshold
colorValue=calculate average color
if colorValue < threshold
return true
else
return false

3.5 Testing example

Figure 9 Validation of
marked answers

Figure 10 Result
presentation

4. DISCUSION
The image processing and computer vision combined
with mobile devices is still a new field. That said, there
are certain technical and other issues that should be
taken into consideration. For example, we have
witnessed that only a part of image processing
frameworks are suitable to be used on mobile platforms.
While most of them are developed in C++ programming
language, few of them offer wrappers which ease the
use of frameworks in mobile applications developed in
other languages such as Java or C#.
The wars of incompatible mobile platforms are taking
their toll here as well. To our best knowledge, OpenCV
came the farthest to support multiple platforms. But it is
at least very questionable if the same image processing
framework could be used to develop native mobile
application for all major mobile platforms. Also, when
choosing appropriate framework for our initial algorithm
implementation on Android mobile platform, we
witnessed a lack of proper API documentation in some
frameworks, which really makes the use and
configuration of framework difficult.

Figure 7 Capturing the


scorecard

Figure 8 Processing
captured image

For demonstration of our implementation, we will


showcase few screens of our application PEAS which
uses that implementation and whose source code can

In a past few years the processing capabilities of mobile


devices have grown exponentially, however, image
processing is still a demanding task. So in order to
assure satisfactory performance, and in the same time
not to overload mobile devices battery, an optimized
algorithm for image processing is a top priority.

https://bitbucket.org/dmacan23/aes_ieee

112

CASEmobile

The scorecard image that needs to be processed by our


algorithm is taken by mobile phone camera. The quality
of taken image can vary depending on quite a few
factors. A lot of these factors that can significantly
influence the image quality are not in our control. For
example, on mobile market there is a large number of
different mobile devices, with different properties and
camera quality; the person that takes a picture can take
blurred picture, or the image perspective can be shifted;
improper lightning in the room, reflections or shades can
also make the content of scorecard hard to detect; the
marked answers could have to small contrast etc.
Neutralizing the unwanted impact of aforementioned
factors is not an easy task. We managed to mitigate the
influence of taking picture in a wrong perspective by
implementing algorithm for perspective correction, but
dealing with reflection, shades, lightning, and contrast
issues is something that we need and plan to improve.
Although it certainly needs to be improved, our
algorithm is implemented in fully functional mobile
application, and even now gives satisfactory results in
recognizing answers on scorecard sheet. Also, in our
opinion, both the algorithm as a whole and the parts of
the algorithm can be applied in different contexts. The
perspective correction algorithm, the algorithm for
detecting square fields, and the algorithm for detecting
marked answers can be easily adapted and used in
many similar mobile applications.

5. CONCLUSION
This paper summarizes our efforts in developing
algorithm for detecting answered questions on
scorecard paper sheet, using image processing on
mobile devices. Image processing and computer vision
is an exciting field in computer industry, which becomes
even more exciting when combined with mobile devices.
As we already stated, applications of these two
technologies combined are numerous and possible in
different areas of industry, education, government
tourism etc. We believe this field is yet going to show its
full potential.
In algorithm implementation we used popular OpenCV
framework through its JavaCV wrapper, since we found
it to be fast, widespread, well documented and crossplatform framework. However, we also identified several
issues and challenges when developing image
processing in mobile applications. Also, we plan to
improve our algorithm in several aspects: neutralizing
shading, lighting, bad contrast, and reflection negative
impacts; optimizing performance; delivering more
responsive, real-time validation of marked answers.
The developed algorithm is implemented in fully
functional Android mobile application which we
demonstrated in Testing example section.
Also, we identified few interesting topics for future
research on image processing mobile applications:
feature and performance comparison of available
frameworks; difference in performance between
wrappers and C/C++ implementation; native mobile vs
web
applications;
cross-platform
development;
optimization of image processing algorithms.

References:
1

M. Petrou, Image processing: the fundamentals, 2nd ed. Chichester, U.K: Wiley, 2010.

Place IKEA furniture in your home with augmented reality - YouTube. [Online]. Available:
http://www.youtube.com/watch?v=vDNzTasuYEw. [Accessed: 17-May-2014].

Google Glass. [Online]. Available: http://www.google.com/glass/start/. [Accessed: 17-May-2014].

Aurasma Reviews | edshelf. [Online]. Available: https://edshelf.com/tool/aurasma. [Accessed: 17-May-2014].

Creative Cloud now includes Creative Suite Master Collection and Design Premium features. [Online]. Available:
http://www.adobe.com/products/cs6.html?promoid=JOLIS. [Accessed: 17-May-2014].

How To Use Augmented Reality In Education - Edudemic. [Online]. Available:


http://www.edudemic.com/augmented-reality-in-education/. [Accessed: 17-May-2014].

OpenBR | Home. [Online]. Available: http://openbiometrics.org/. [Accessed: 17-May-2014].

Eric Chu, Jim He, and Andrew Spencer, OpenCV and TYZX: Video Surveillance for Tracking. [Online]. Available:
http://prod.sandia.gov/techlib/access-control.cgi/2008/085776.pdf. [Accessed: 17-May-2014].

Kim-Sung Jie and Ming Liu, Computer Vision based Real-Time Traffic Monitoring System. [Online]. Available:
http://eng.monash.edu.au/civil/assets/document/research/centres/its/confs-workshops/archive/liu-tram.pdf.
[Accessed: 17-May-2014].

10

Drowning detection, pool surveillance with Poseidon. [Online]. Available: http://www.poseidontech.com/us/system.html. [Accessed: 17-May-2014].

11

Camera Mouse. [Online]. Available: http://www.cameramouse.org/index.html. [Accessed: 17-May-2014].

12

OpenCV vs VXL vs LTI: Performance Test | AI Shack. [Online]. Available: http://www.aishack.in/2010/07/opencvvs-vxl-vs-lti-performance-test/. [Accessed: 15-May-2014].

13

OpenCV, OpenCV, 2014. [Online]. Available: http://opencv.org/. [Accessed: 15-May-2014].

14

The CImg Library - C++ Template Image Processing Toolkit. [Online]. Available:
http://cimg.sourceforge.net/reference/group__cimg__faq.html#ssf12. [Accessed: 16-May-2014].

15

Community Core Vision. [Online]. Available: http://ccv.nuigroup.com/. [Accessed: 16-May-2014].

16

Computer Vision (FastCV) - Mobile Technologies - Qualcomm Developer Network. [Online]. Available:
https://developer.qualcomm.com/mobile-development/add-advanced-features/computer-vision-fastcv. [Accessed:
16-May-2014].

CASEmobile

113

17

LTI-Lib. [Online]. Available: http://ltilib.sourceforge.net/doc/homepage/index.shtml. [Accessed: 16-May-2014].

18

VXL - C++ Libraries for Computer Vision. [Online]. Available: http://vxl.sourceforge.net/. [Accessed: 16-May-2014].

19

aforge - AForge.NET Framework - Google Project Hosting. [Online]. Available: https://code.google.com/p/aforge/.


[Accessed: 17-May-2014].

20

OpenCV - Contributors - OpenCV DevZone. [Online]. Available:


http://code.opencv.org/projects/opencv/wiki/Contributors?version=2. [Accessed: 17-May-2014].

21

Itseez/opencv GitHub. [Online]. Available: https://github.com/Itseez/opencv. [Accessed: 17-May-2014].

Information on authors:
Alen Huskanovi
e-mail: ahuskano@foi.hr
Alen Huskanovi is a regular student of the third year of undergraduate study Information Systems at the Faculty of
Organization and Informatics in Varazdin. He has participated in various national and international competitions, among
which stands out IEEEmadC international competition for the design of mobile applications where he won first prize.
Actively working on the system PEAS with whom he came to Croatian finals of Microsoft Imagine Cup. He is primarily
engaged in the development of applications for the Android operating system.
David Ante Macan
e-mail: amacan@foi.hr
David Ante Macan is a third year undergraduate student of Information Systems at Faculty of Organization and
Informatics. He has participated in various competitions, including the Croatian Microsoft Imagine Cup finals, won the best
design award at IEEEmadC contest, won the third place at Infinum student Hackathon 2014, etc. His main area of interest
is mobile development, especially Android. He is actively working on several projects, including the Personal Exam
Assistant (PEAS) project at Faculty of Organization and Informatics. He is also a member of IEEE Institute and is one of
the student coordinators and founders of the Laboratory for mobile technologies (MT Lab) at Faculty of Organization and
Informatics.
Zoran Antolovi
e-mail: zantolov@foi.hr
Zoran Antolovi is a third year undergraduate student of Information Systems at Faculty of Organization and Informatics,
University of Zagreb. Primarily interested in web development and design, he participated in various projects, such as
Microsoft Imagine Cup (finals 2014), Best Code Challenge 04 (top 10 2014), first place at Infinum Student Hackathon
2014, first place in Best design category at IEEEmadC international competition with PEAS mobile application. With other
students, he has participated in Nestala djeca (missing childrens) project, developing entire web application and web
services for mobile application.
Boris Toma
e-mail: boris.tomas@foi.hr
Boris Toma, M.A. is a Junior researcher and Teaching Assistant at the Faculty of Organization and Informatics,
University of Zagreb where he works at the Department of Information System Development. Boris' assignments at the
Faculty are laboratory sessions delivered on the courses Geography Information Systems and Software Engineering.
Fields of interest are: software development, mobile technologies, geoinformatics, bioinformatics, artificial intelligence,
application marketing, Internet marketing. During his work career he worked on several projects in various positions. Boris
is currently a doctoral student at the Faculty of Organization and Informatics, University of Zagreb. For his academic
achievements he received Faculty Dean's award and University Rector's award.
Marko Mija
e-mail: mmijac@foi.hr
Marko Mija, as of July 2011 works at the Faculty of Organization and Informatics in Varadin as a project KI Expert
2012, project MEDINFO associate, and as a teaching assistant on courses related to software engineering and
information systems. Prior to his current employment he worked as a developer of intranet production planning system at
Boxmark Leather d.o.o. He is interested in web, desktop and mobile applications development in various platforms and
technologies.
Faculty of Organization and Informatics
Pavlinska 2
42000 Varadin
tel: +385 42 390 853
fax: +385 42 213 413

114

CASEmobile

CASEmobile

115

NOVI KONCEPT RAZVOJA APLIKACIJE - ZA PROGRAMERE I ONE KOJI TO NISU


NEW CONCEPT OF APPLICATIONS DEVELOPMENT FOR DEVELOPERS AND NON-DEVELOPERS
Ivan Curi, Tomislav Bronzin

SAETAK:
to je zajedniko, a po emu se razlikuju novi alati za razvoj aplikacija: Windows App Studio, TouchDevelop, Project
Siena i CodeAnywhere?
Zajedniko je to to svi alati (osim zadnje spomenutog CodeAnywhere) omoguavaju razvoj Windows Phone ili Windows
8/8.1/RT aplikacija na tabletima, a mogu ih koristiti i ljudi koji nisu razvojni inenjeri. Svi alati koriste raunalni oblak kako
bi omoguili dvije stvari: dostupnost razvojne okoline s (gotovo) bilo kojeg ureaja, s bilo koje lokacije prvenstveno na
tabletima i velikim oslanjanjem na raunalni oblak to za pohranu programskog koda, to kao alat za izvravanje i
debugging. Veina njih odlino koristi novo suelje upravljano dodirom (touch) ili olovkom (stylus), dok samo
CodeAnywhere se koncentrira vie na tipkovnicu i pisanje pravog koda. App Studio omoguuje generiranje izvornog
programskog koda po programskom predloku MVVM, pa ga razvojni inenjeri mogu dalje koristiti u Visual Studio-u, dok
TouchDevelop generira skriptu koja se moe pokrenuti na webu. Rezultati ovakvog naina izrade aplikacija su efektne i
brzo napravljene aplikacije upravljane dodirom, koje moete publicirati u trgovine aplikacija.
Kljune rijei: Windows App Studio, TouchDevelop, Project Siena, CodeAnywhere

ABSTRACT:
What is common and what is different about new tools for application development: Microsoft App Studio,
TouchDevelop, Project Siena and CodeAnywhere?
The common factor is that all tools (except for the last mentioned CodeAnywhere) enable the development of Windows
Phone and Windows 8/8.1/RT applications on tablets, and can be used by people who are not developers. All tools use
cloud computing to enable two things: the availability of development environments on (almost) any device from any
location, primarily on tablets and heavy reliance on cloud computing - to store program code and as a tool for executing
and debugging. Most of them has used new touch-controlled interface (touch) or pen (stylus), while only CodeAnywhere
concentrate more on the keyboard and writing "real code". App Studio allows you to generate source code that follows
MVVM programming pattern, so it can be further developed using Visual Studio, while TouchDevelop generates a script
that can be run on the web. Results of this approach to application developing are effective and quickly made apps
controlled by touch, which can be published to app stores.
Keywords: Windows App Studio, TouchDevelop, Project Siena, CodeAnywhere

1. INTRODUCTION
In recent years we have witnessed the overwhelming
success of smartphones and tablet devices, as well as
the rapid development of mobile platforms. Today we
have some excellent mobile operating systems like iOS,
Android and Windows Phone, as well as a multitude of
excellent smartphone devices available in the market at
affordable prices. In addition to smartphones, we have
tablets, which are also very popular and use the same
platform as the smartphones. These platforms count
billions of users who own a smart device and use apps
daily and is increasingly replaced PC devices that falls
into the background. Mobile devices are first choice and,
in less developed countries, possibly the only computing
devices which virtually all people will own and carry with
them all the times. [2]
Most people wants to make their own apps, but does
not have proper skills and knowledge for that. They are
not prone to source code writing and making an app in
that way, instead of that they are used to nice, touch
friendly user interface and find it convenient to build an
app by dragging a building blocks just like playing a
video game.

There are several Microsoft developed platforms that


makes that possible, like Windows App Studio,
TouchDevelop and Project Siena. You can use those
platforms to quickly build an app by just clicking and
connecting different building blocks, and without any
programming skills needed.
On the other hand, CodeAnywhere is completely
different and requires programming skills. It is a multiplatform cloud based code editor that enables you to
make apps from your browser, no matter what device
you are using. CodeAnywhere enables developers to
write source code on any device and in any place so it
represents a new concept for developers.
This paper shows new concepts of applications
development using touch-enabled devices and cloud
computing that enables you to make apps using any
device and from any location, with or without
programming skills necessary. Paper represent a new
concepts in applications development that shifts from
traditional source code writing on PCs using keyboard
and mouse, and shows that applications development is
evolving to easier and user friendly experience, that
does not necessary involve strong programming skills
and knowledge.

116

CASEmobile

2. WINDOWS APP STUDIO

3. PROJECT SIENA

Windows App Studio is the easiest way to start building


apps for Windows and Windows Phone in a few easy
steps. Windows App Studio lets you swiftly build
Windows and Windows Phone apps to test, publish, and
share with clients, co-workers, friends, and family. It
enables you to create app with few clicks of a mouse
and data entry, without the need for real programming
knowledge or environment. That way it is best suited for
people without experience in software development,
who wants to make functional apps and publish them to
Windows Store. [9]

Microsoft Project Siena (code name) is a new


technology for business experts and other app
imaginers, which enables them, without any
programming, creation of apps that harness the power
of corporate data and content, as well as web services.
[3]
Project Siena is a Windows Store App that enables you
to create a Windows Store apps. It is a visual app
designer that enables you to build an app by selecting
and placing an element on app screen, and visualizing
provided data, without any programming skills needed.

Windows App Studio is a web-based development


platform that uses point-and-click development with no
coding required. It targets Windows platform exclusively
and is useful for information and promotion type apps,
such as: fan apps (bands, sports teams, movies),
guides (vacation destinations, city guides), collections
(recipes, photos, videos), store apps (product lists and
information) and event apps (wedding or party). If
features in App Studio are not enough for your app, or
you want to add some new complex features, the
platform enables you to extend or enhance your app
with code. [7]
App Studio can also be used to make prototypes of
apps, to make better understanding of client needs and
requirements, so that app can be represented to a client
as soon as possible. And when you're ready to try add
advanced programming features, Windows App Studio
generates your source code - a feature no other appbuilder tool provides.
With Windows App Studio, you can:
Build a universal Windows app for Windows Phone
8.1 and Windows 8.1 in a single session
Download your app directly onto your Windows
device to share
Download the source code so that you can extend it
with Visual Studio
Download the app package so that you can publish
your app to Store through Dev Center
You can develop apps in App Studio by selecting one of
existing templates that can help you build app even
faster. Next step is to provide app title, description and
logo. These information are also used to publish app to
Windows Store. App content can be provided from
several data sources like Flickr, YouTube, Rss Feed,
Facebook, Instagram, Bing, HTML, and from user
defined data collections.

Figure 11- Windows App Studio look and feel


App Studio also enables you to design your app by
choosing custom color theme, and by providing splash
screen, lock screen and logo images, and by designing
app tile.

Figure 12 - Project Siena app look and feel


Siena is designed to create apps that are more
document-like and highly visual, with a canvas for
inserting images, buttons, shapes, videos, and more.
Its very similar to Microsofts Windows App Studio that
lets anyone create apps on the web. The difference is
that Siena provides similar experience but as a touchfriendly environment on a tablet or PC running Windows
8.
Examples of the kinds of apps people have been
building:
Apps for consuming information, such as product
catalogs and video-based lesson plans.
Apps for on-the-spot decisions, such as adjusting
insurance claims and accessorizing an outfit.
Apps for tasks that involve capturing pictures,
audio, handwriting, and other real-world input.
These are apps for the device-first and cloud-connected
world, with the potential to transform todays business
processes and customer interactions.
Building a Siena app is as easy as editing a PowerPoint
presentation or Excel spreadsheet. You place some
visuals on a canvas. You hook them up to your data or
favorite services. You customize how your app looks
and works. Then, if you need special logic and
intelligence, you write some Excel-like expressions. You
can use your app immediately, or share it with
colleagues or the world. [5]
Siena works well with corporate and web data:
SharePoint lists, Excel and Azure tables, RSS feeds
and REST services. The authored apps are IT-friendly.
Since the output is just HTML/JavaScript, developers
can also open up and extend them in their favorite
HTML/JavaScript programming tools, if needed.
Project Siena is still in beta phase, and is constantly
upgraded. These are some of the new features that can
be expected:
Apps that run across multiple device platforms
Support for global languages
Connections to Office 365 services

CASEmobile

Ever-easier app
generated rules

building

with

contextually

The main attractions of Project Siena are:


Conceptualize, validate, and build your app ideas
as easily as editing a document.
Connect to corporate and web data.
Compose rich interactive visuals to create custom,
unique apps.
Add business logic and intelligence using the power
of Excel expressions.
Use the app yourself, and share it with colleagues
or the world.

4. TOUCHDEVELOP
TouchDevelophttp://en.wikipedia.org/wiki/TouchDevelop
cite_note-1 is
an interactive
development
environment and a visual programming language being
developed at Microsoft Research. TouchDevelop is a
development environment for mobile and Web apps that
runs on phones, tablets, PCs, and even giant
touchscreens, and enables you to create fun games and
useful tools regardless of your working environment. It
lets you create apps on iPad, iPhone, Android, PC, Mac
and Windows Phone. [8]
In the TouchDevelop programming environment you
write scripts by tapping on the screen. You do not need
a separate PC or keyboard. Its programming language
and code editor have been built from scratch around the
idea that all code is entered via a touchscreen, without a
keyboard.

117

programming and mobile device technology at schools,


colleges and universities.

5. CODEANYWHERE
Codeanywhere is a multi-platform cloud based code
editor that enables you to write code and collaborate no
matter where you are or what device you have with you.
Codeanywhere, a self-proclaimed Google Docs for
coders, wants to become the defacto standard for code
development on the go and enables you to write code
and fix bugs in the cloud. It comes really handy in a
situations where you do not want to bring your
programming device with you, instead of that you can
access your projects and code on the go, and from
virtually anywhere using this cloud solution.
Codeanywhere is a text, code and markup editor that
has been redesigned and reengineered to be light, fast,
and mobile-friendly. It enables you to connect to your
FTP, SFTP Servers, Dropbox or Github account and
easily manipulate your resources, folders or files just
with the swipe of your finger. It also enables you to
share and collaborate on projects or just a single file,
from wherever you are, and to quickly edit code with
special keyboard that has been customized for
developers on the go. Codeanywhere makes
developers forget what device they are working on and
let them concentrate on getting work done on any
device like iPad, iPhone, Android or the desktop. [1]
Codeanywhere offers iOS, Android, Blackberry and
Windows Store apps in addition to a web option. Some
of the main features include:
Code Editor
Image Viewer
FTP Client
SSH
Dropbox/GitHub Integration

6. CONCLUSION
Figure 13 - TouchDevelop programming environment
Scripts can perform various tasks similar to regular
apps. Any TouchDevelop user can install, run, edit, and
publish scripts. You can share scripts with other people
by publishing them to the TouchDevelop script bazaar,
by submitting them as an app to the Windows Store or
Windows Phone Store, or by sharing them as crossplatform HTML5 Web Apps. [4]
TouchDevelop uses the latest web technologies that
can run in most modern web browsers to bring a cloudconnected, touch-friendly app creation environment to
every device, and it also works offline. It enables users
to program their mobile devices directly on the devices.
TouchDevelop scripts are written and run in the
TouchDevelop IDE, which can be installed on either a
Windows Phone or a web browser for other platforms
such as Android and iOS. To ease programming on
mobile devices, the IDE provides a semi-structured
code editor, which presents users with a small number
of possible choices (e.g., different types of statement) at
each step. In this manner, the users build the skeleton
of the script via touching to select choices, leaving only
variable names and expressions for typing. [6]
In addition to its use as a tool for creating application
programs, TouchDevelop has been used to teach

As the use of smartphone and tablet devices escalated


in the last years, there is a need to new, intuitive and
user friendly environments to make apps for those
devices. Some common requirements are set for those
new concepts, like:
Provide a way to make apps without programming
skills necessary
Provide a platform for fast app creation using
predefined app templates
Provide a way to make apps using touch-enabled
devices like smartphones and tablets
Microsoft made strongest effort here, providing several
platforms and concepts for this kind of app
development. By that, they have enabled an easy way
for their users to present various content on their
platforms, Windows Phone and Windows 8.xx.
The common factor of all presented tools, is that all
tools (except for the last mentioned CodeAnywhere)
enable the development of Windows Phone and
Windows 8/8.1/RT applications on tablets, and can be
used by people who are not developers. All tools use
cloud computing to enable two things: the availability of
development environments on (almost) any device from
any location, primarily on tablets and heavy reliance on
cloud computing - to store program code and as a tool
for executing and debugging. Most of them has used
new touch-controlled interface (touch) or pen (stylus),
while only CodeAnywhere concentrate more on the

118

CASEmobile

keyboard and writing "real code". App Studio allows you


to generate source code that follows MVVM
programming pattern, so it can be further developed
using Visual Studio, while TouchDevelop generates a
script that can be run on the web. Results of this
approach to application developing are effective and

quickly made apps controlled by touch, which can be


published to app stores.
It remains to see how popular these platforms will be,
and will users accept them as a new concepts in
applications development. But one thing is for sure, they
all represent the direction in which application
development is developing.

References:
1

CodeAnyWhere Inc. webpages. [Online] Available: https://codeanywhere.com/. [Accessed: 26-May-2014].

I. Curi and D. Adamec, Development of web applications adaptive to different screen sizes (Responsive Web
Apps), in Razvoj poslovnih i informacijskih sustava CASE 25, Zagreb, 2013.

Microsoft Project Siena. [Online] Available: http://technet.microsoft.com/en-us/dn518139. [Accessed: 26-May-2014].

Microsoft Research: TouchDevelop. [Online] Available: http://research.microsoft.com/en-us/projects/touchdevelop/.


[Accessed: 27-May-2014].

S.Somasegar, Project Siena Beta 2: Enabling business users to create apps connected to enterprise services, web
and social, 2014. [Online] Available: http://blogs.technet.com/b/projectsiena/archive/2014/03/24/project-siena-beta2.aspx. [Accessed: 26-May-2014].

Sihan Li, Tao Xie, and Nikolai Tillmann, A Comprehensive Field Study of End-User Programming on Mobile Devices,
in Proc. IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC 2013), September 2013.

Tomlinson, Bryan, Introduction to Mobile App Development, 2013. [Online] Available:


https://www.facultyresourcecenter.com/curriculum/9175-introtoapps.aspx. [Accessed: 26-May-2014].

TouchDevelop website. [Online] Available: https://www.touchdevelop.com/. [Accessed: 26-May-2014].

Windows App Studio How To. [Online] Available: http://appstudio.windows.com/Home/HowTo. [Accessed: 26-May2014].

Information on authors:
Ivan Curi, mag.inf.
e-mail: icuric@citus.hr
Ivan Curi is program manager in CITUS Ltd. and master of informatics in fields of information and software engineering.
He has gained practical knowledge managing complete lifecycle of several important projects like Conference@Net web
system for organizing conference and events, and C@N Motion - interactive multimedia kiosk that allows for managing
content using hand gestures at distance, through Microsoft Kinect device. Development areas he is intensively engaged
are development of Kinect application, ASP.NET MVC framework for web apps development and multiplatform
development of mobile apps. Ivan is EUCIP and Microsoft certified, author of several professional papers in the field of
information systems development and speaker on several conferences, like Mobility Day, MS WinDays, MS NetWork,
KulenDayz, CASE.
Tomislav Bronzin, mag.ing.el.
e-mail: tbronzin@citus.hr
Tomislav Bronzin is Microsoft Most Valuable Professional and founder of CITUS, Microsoft Silver Partner Company that is
specialized in software development, consulting and training. His specialty is development of distributed applications,
focusing on Windows Mobile and Unified Communication. Tomislav is trainer and speaker at Microsoft conferences like
Microsoft TechEd Europe, DevDays, PASS Europe, DevReach, WinDays, Sinergija, Vizija etc. He is teaching at several
universities and mentoring student teams for Imagine Cup Championship. Tomislav is INETA Europe Vice President and
organizer of http://www.mobilityday.com conference. He is author and one of the 4 MVP's and MCT's that are teaching
atwww.developersbootcamp.com based
on
his
experience
as
Solution
Architect
for
projects
like www.protectatwork.com. Protect@Work is distributed application based on most recent technologies like windows 8,
mobile (all platforms) & cloud computing. Tomislav has been Microsoft Regional Director for 10 years (2003-2013).
CITUS Ltd.
Dragutina Golika 63
10000 Zagreb
e-mail: helpdesk@citus.hr
web: www.citus.hr
tel.: +385 1 3667 120

CASEmobile

119

KORITENJE GOOGLE CLOUD MESSAGING SERVISA U ANDROIDU


USING GOOGLE CLOUD MESSAGING SERVICE IN ANDROID
Zoran Kos, Zlatko Stapi

SAETAK
Rad prikazuje mogunosti koritenja Google Cloud Messaging (GCM) servisa za Android platformu, te koji omoguuje
developerima da pomou web servisa alju notifikacije i podatke instaliranim aplikacijama, na pametnim i mobilnim
ureajima ili tabletima. GCM pritom vodi brigu o stanju u kojem se mobilni ureaj nalazi, a asinkrona komunikacija je
mogua i u suprotnom smjeru, to jest od mobilne aplikacije prema servisu. GCM raspolae s mnogo korisnih znaajki
poput send to sync i senddata mogunosti, podrke za multicast poruke, rada u sluaju mirovanja, uporabu
perzistentne veze (upotreba XMPP-a), upstream slanja poruka i sinkronizacije obavijesti na veem broju mobilnih
ureaja. Takoer ova usluga se moe iskoristiti za lociranje ukradenih telefona, daljinsko podeavanje telefona, slanje
poruka prilikom postizanja odreene razine u igrama itd. Ukratko, usluga GCM je odlian nain za programere da
upravljanju s provjerenim aplikacijama, ali sa sobom nosi i odreene nedostatke jer je u zadnje vrijeme postala predmet
raunalnog kriminala.

ABSTRACT
This article presents the possibility of using Google Cloud Messaging (GCM) service for the Android platform. GCM
provides programmers and developers the possibility to send notifications and data to smart phones or tablets installed
applications, by means of using the Web services. It also takes care of the state in which the mobile device, and gives a
possibility of asynchronous communication in the opposite direction from mobile application to the service. GCM has
many useful features such as: Send to Sync and Send data capabilities, support for multicast messages, delay while
idle, the use of persistent connections (by using XMPP), the upstream messaging and synchronization notification across
multiple android devices. Also, this service can be very useful for locating stolen phones, remote adjustment of the
mobile device sending a messages when user reach a certain level in the game, and so on. Shortly, the GCM is a great
way for Android developers to manage their applications, but it also has its disadvantages and it recently became the
subject of cyber-attacks.

1. INTRODUCTION
Google cloud messaging (GCM) for the Android
platform is a service that provides applications
programmers and developers to communicate with
applications installed on smart phones, tablets, Chrome

apps and extensions, from servers. GCM was officially


presented in 2012. at Google I/O conference in San
Francisco, California. The next year, at the same
conference, new improvements were introduced
(Google Developers, 2013). Through this service, it is
possible to send a wide range of information, from

Figure 1 - GCM life cycle flow (HMKCode, 2014)

120

CASEmobile

ordinary notifications to the commands that are


executed inside the application by providing fresh and
up-to-date data for users. This service has been
developed to assist developers in building apps whose
communication or data transfer goes asynchronous in
two directions, between service and applications on the
same connection (push notification). This data could be
a lightweight message telling the Android application
that there is a new data to be fetched from the server
(for instance, a "new email" notification informing the
application that it is out of sync with the backend), or it
could be a message containing up to 4KB of payload
data (so apps like instant messaging can consume the
message directly) (Android Developers, 2014a). Google
uses GCM for the processing and sending instant
notifications for many popular applications including
Twitter, Facebook and Gmail. This applications use
GCM to inform the users about: the friends that have
checked in nearby; the received a message; any related
notice with user profile.
The strength of this service can be seen in the fact that
it can serve more than 200,000 push notification every
second. This paper describes how the messaging
works, and it consists of five sections. After this
introduction the second section describes the main
characteristics and components of which GCM is
composed. The third chapter describes initial steps that
have to be made on the client and the server side
implementation of the GCM. It also describes what are
user notifications and their role in the GCM. The fourth
chapter shortly writes about the vulnerabilities and
attacks that were recorded on GCM. At the end of this
paper conclusion is given.

2. THE MAIN GCM CHARACTERISTICS


The GCM architecture is graphically presented in Figure
1 and it contains the three following main components:
Client Application receives the message from
GCM connection server initially sent by the
application server and sends the new message to
the same server.
3rd-party Application server receives the client
app registration ID; based on the registration ID
records in the database sends the message to the
GCM connection server.
GCM connection server receives the messages
from the application server and sends these
messages to the GCM enabled android devices.
Before using GCM there was the Android Cloud to
Device Messaging (C2DM) service that helped sending
data from servers to applications on the mobile devices.
But with appearance of GCM, C2DM has been officially
deprecated, meaning that the C2DM stopped accepting
new users, denies new quota requests and has no new
available features. The reason for deprecation was that
GCM can be simply put to use. There is no signup form;
no quotas or client login token, it takes 4.7 ms to deliver
the messages, and all of this reduces battery usage and
gives a rich set of new APIs. GCM also provides a client
and server helper library which means that developers
can easily write code. The GCM service is completely
free and handles all aspects of queuing of messages
and delivery to the target Android application running on
the target device. Considering these changes it is not
possible to establish interoperability between GCM and
C2DM. All GCM major features that are new and make
a difference in relation to C2DM are placed in Table 1:

GCM features and APIs

Simple API key


Sender ID
Canonical registration ID
Json format
Multicast messages
Time-to-live messages
Messages with payload
Send-to-Sync messages
Upstream messaging
Seamless multi-device messaging
Multiple senders
Table 1 GCM features and APIs
Key Concepts of GCM are components, entities of GCM
architecture and the credentials used for access
authentication in different stages of GCM. Credentials
can ensure that all components have been properly
authenticated so that data transfer and messaging is
going to the correct place and without delay. Credentials
are the IDs and tokens used in different stages of GCM
which are listed below (Android Developers, 2014a):
Sender ID a project number given from API
console, used in the registration process to identify
a 3rd-praty app server.
Application ID located in manifest and identified
by the package name. This ID ensures that the
messages are targeted to the correct app.
Registration ID issued by the GCM servers to the
app that allows it to receive messages. This ID is
tied to a particular app running on a particular
device. 3rd-party app server can identify each
device that has registered to receive messages for
a given app. If client app no longer wants to receive
messages it can unregister GCM.
Google User Account used only if uses Android
API is lower than 4.0.4.
Sender Auth token is an API key that is saved on
the 3rd-party app server. It gives app server
authorized access to Google services. The token is
placed in the header of POST requests that send
messages.
If we put attention on Figure 1 we can see the lifecycle
flow of GCM which consists of three processes that are
described in more detail below:
Enable GCM
Send a message
Receive a message
To enable GCM, client app that runs on mobile device
calls register method which returns the register ID in
order to receive messages. A 3rd-party app server sends
messages to the device, and this process consists of
several steps (Android Developers, 2014a):
Google checks and stores the message in case the
device is offline.
When the device is online, Google sends the
message to the device.
The system broadcasts the message to the
specified app via Intent broadcast with proper
permissions, so that only targeted app gets the
message.
App processes the message.
Process receive a message consists of a sequence of
steps starting from extracting the raw key/value pairs
from the message payload. After that system transmits
this key/value pairs to the targeted app as a set of

CASEmobile
extras to broadcast receiver. App then extracts raw data
from this intent and processes the data. The app server
sends a message to GCM servers. The described
processes make the life-cycle of GCM which is shown in
Figure 2:

121

becoming trial partner with Google available at given


URL: https://services.google.com/fb/forms/gcml/.

3.1 How to implement GCM Client


As mentioned earlier in the previous chapter, the GCM
client is GCM-enabled app that runs on mobile device
which uses GoogleCloudMessaging API. It is also
possible to use the client helper library that was offered
in previous version of GCM but now its not
recommended to be used because some methods in
this library are deprecated. The following example
shows how to implement GCM client in mobile device
that runs on Android platform. For purposes of better
presentation and programming, the next example parts
of the codes are taken and modified from publicly
available pages (tutorials) which can be found at
(Android Developers, 2014b) and (Cambell, 2013). To
implement a GCM client-side application, application
must include code to register (Registration ID) and
broadcast receiver to receive messages sent by GCM.
In order to do that we can use the form shown in Fig. 3:

Figure 3 Registration application form


Figure 2 GCM Life Cycle Flow (freelancersnepal, 2014)

This chapter provides short guidelines, the developers


should hold, in order to successfully implement the
GCM. Before GCM can be used in java project, some
steps should be taken. They are listed and explained
below:
1
Installation of Google Play services SDK
provides the GoogleCloudMessaging methods and
it can be used in combination with Eclipse ADT
environment.
2
Creating a Google API project inside the Google
Developers Console it creates project ID and
project number.
3
Enabling the GCM service API inside created
project.
4
Creating a Server key with option to whitelist
specific IP addresses. This key is used by
developers server app as a password when
connecting to Googles Command and Control
server.

Starting point is to include GoogleCloud Messaging


API (available within Google play services SDK) into the
project. Without this API it is not possible to implement
GCM on client side. The second point is writing
permissions in the application manifest:
com.google.android.c2dm.permission.REC
EIVE app can register and receive messages.
com.google.android.c2dm.intent.
RECEIVE if set, only the GCM Framework can
send a message to it.
android.permission.INTERNET for sending
registration ID to the 3rd party server.
android.permission.GET_ACCOUNTS
if
mobile device is running on lower API then Android
4.0.4, GCM must require a Google account.
android.permission.WAKE_LOCK client app
can keep the processor from sleeping when a
message is received.
applicationPackage.permission.
C2D_MESSAGE prevents other apps from
registering and receiving the GCM message.

After successfully completing above steps GCM project


in the API Console is created and its possible to start
implementing GCM. Developers can thereby decide
which of the available GCM connection servers will be
used (HTTP or XMPP). Then, it is possible to start
implementing an app server to interact with chosen
GCM connection server or GCM-enabled app that runs
on a device. Those who do not have own available 3rdparty app server can use upstream messaging (deviceto-cloud) feature or user notification via Command and
Control server (CCS is an XMPP endpoint that
provides a persistent connection to Google server) by

For a better understanding it is necessary to pay


attention to receive permission. Because, if client app
uses an IntentService (class for Services that
handle asynchronous requests on demand), broadcast
receiver
should
be
an
instance
of
WakefulBroadcastReceiver (creates and manages
partial wake lock on client app). A Service (typically an
IntentService)
to
which
the
WakefulBroadcastReceiver passes the work of
handling the GCM message, while ensuring that the
device does not go back to sleep in the process codes
like this (Android Developers, 2014b):

3. IMPLEMENTATION OF THE GCM

122

CASEmobile

<receiver
android:name=".GcmReceiver"
android:permission="com.google.android.
c2dm.permission.SEND"
>
<intent-filter>
<action android:name="com.google.
android.c2dm.intent.RECEIVE" />
<category android:name="com.
case26.gcmdemo" />
</intent-filter>
</receiver>
<service android:name=
".GcmIntentService" />
Code 1 Enabling send messages
Broadcast receiver performs operations automatically
when service starts with operations. The following code
snippet starts GcmService with the method
startWakefulService()inside the
GcmReceiver class:
// Explicitly specify that GcmService
will handle the intent.
ComponentName comp=new
ComponentName(context.getPackageName()
,GcmService.class.getName());
// Start the service, keeping the device
awake while it is launching.
startWakefulService(context,
(intent.setComponent(comp)));
setResultCode(Activity.RESULT_OK);
Code 2 Starting GCM Service
Client app cannot receive messages before it is
registered with the GCM servers. To achieve this,
developers must use class that extends the
GoogleCloudMessaging class with AsyncTask
object so receiving process can be performed in the
background. AsyncTask class enables easy use of
the UI thread and performing background operations.
Usually, registration should occur in the onCreate()
method in main activity or using a dialog if we want to
give the user a choice about receiving GCM messages.
It is necessary to include values of variables
Sender_ID and Application_ID given by Google
Developers Console. Once the registration ID is
retrieved it is stored locally on the device
(SharedPreferences) and sent to 3rd party server. It
is recommended to use HTTP connection so developers
can have an immediate answer if the registration went
well or not. The following code snippet shows short
registration process, described previously:
if(gcm == null){
gcm=GoogleCloudMessaging.
getInstance(context);
}
regID=gcm.register(Globals.
GCM_SENDER_ID);
// Send the registration ID to 3rd part
server server via HTTP
sendRegistrationIdToBackend();
// PersisttheregID no need to
registeragain

storeRegistrationId(context, regid);
Code 3 Registers the app with GCM server
asynchronously
If the registration went well with no errors as the
feedback of Figure 4 on the screen of demo application
will be show the following:

Figure 4 retrieved Register ID


Based on the obtained Register ID, client app can also
send messages to 3rd party application server over
GCM server. The content of the message depends on
what the developer wants to get out of the user's
activities. It is important to point out that the GCM
message is a JSON object containing some required
and optional fields. There are several different formats
depending on the direction in which communication
goes:
Request format - from a 3rd-party app server or
client app to CCS.
Response format from CCS to 3rd-party app
server (including ACK and NACK message
formats).
For each device message that the 3rd-party application
server receives from CCS it needs to send an ACK
message. 3rd-party application server never sends a
NACK message. CCS sends an ACK or NACK for each
server-to-device message, if client app doesnt send an
ACK for a message; CCS will just resend it again. The
following code snippet shows how request format of
JSON massage should look like:
"to":"REGISTRATION_ID",
"message_id":"m-453443534546",
"data":
{
"message":"case26",
"action":"com.case26.gcmdemo.ECHO",
}
"time_to_live":"500",
"delay_while_idle": false
Code 4 JSON massage, Request format
We could get specified format with following code
snippet which is written in java GcmActivity class:
newAsyncTask(){
@Override
protectedStringdoInBackground
(Void...params){
String msg = "";
try{
Bundle data = newBundle();
data.putString("my_message",
"case26");
data.putString("my_action",

CASEmobile
com.case26.gcmdemo.ECHO ");
String id =Integer.toString
(msgId.incrementAndGet());
gcm.send(SENDER_ID +"@gcm.
googleapis.com", id, data);
msg="Sent message"; }catch
(IOException ex){
msg="Error :"+ex.getMessage();
}
return msg;
}
}
Code 5 Upstream a GCM message up to the 3rd party
server

123

implementation, because we can use Push Bot


services API for push messing described in next
chapter. Push Bot can push notifications via XMPP to
feeds that support server-to-server PuBSUBHubbub
protocol. These Servers can get near-instant
notifications when a topic theyre interested in is
updated (PushBots, 2012). To use this API, in the
Android project Pushbots131beta.jar library should be
included. With this library, inside the onCreate(Bundle
bundle) method, developers can implement push
notification for mobile devices with a one single line of
code:
Pushbots.init(this, Sender_ID,
Pushbots_App_ID);
Code 6 PushBot function

3.2 How to implement GCM Server


As mentioned previously, server side of GCM consists
of Google-provided GCM Connection Servers (HTTP or
CCS over XMPP) and 3rd-party application server which
developer must implement. 3rd-party server must be
able to communicate with client and GCM Connection
Servers with properly formatted requests and be able to
respond incoming requests to it. Its also important that
each exchanged massage have a unique message ID
that is located in the header of POST request. The first
step that developer has to do is to make a decision
which type of GCM connection server(s) to use. For a
better understanding differences between two types of
connection server(s) through the basic features are
listed (Android Developers, 2014c):
Upstream/Downstream messages:
HTTP: Downstream only: cloud-to-device
CCS: Upstream and downstream (device-to-cloud,
cloud-to-device)
Asynchronous messaging
HTTP: 3rd-party app servers send messages as
HTTP POST requests and wait for a response
CCS: 3rd-party app servers connect to Google
infrastructure using a persistent XMPP connection
and send/receive messages to/from all their
devices at full line speed.
JSON messages
HTTP: sent as HTTP POST
CCS: encapsulated in XMPP messages.
Before we go on with implementing GCM Server, it is
important to pay attention to types of messages. Every
message sent in GCM has payload limit of 4096 bytes
and by default it is stored by GCM server for 4 weeks.
There is two main types send-to-sync (collapsible
message) and message with payload (non-collapsible
message). Send-to-sync message tells a mobile device
to sync data from server, where the most recent
message is relevant. New message will replace the
preceding message.
GCM message parameter collapse_key plays here
an important role because its used to collapse a group
of similar messages when the device is offline. This
means that only the most recent message gets sent to
the client app. GCM allows a maximum of 4 different
collapse keys to be used by GCM server at given time.
More than four collapse keys could cause unpredictable
consequences.
Messages with payload are delivered every time;
collapse_key is omitted; the payload the message
can be up to 4kb and after 100 stored messages, GCM
will discard old messages. For demonstration purposes,
we will not use our own 3-rd-party server

When the message is sent using the GCM on the


screen of android Mobile device, there will be the
following content in the notification area:

Figure 5 Message sent to device via 3rd party


application server

3.3 User notification


User notification is feature that enables 3rd-pary app
server to send a single or multiple messages to client
apps and app instance that a user owns to reflect the
latest messaging state. The way this works is that
during registration, the 3-rd party server requests a
notification key which is used as an address to send
messages (Android Developers, 2014a). The notification
key maps a particular use to all of the users associated
registration IDs, allowing him to send message to all of
the users regIDs. To create a user notification key, a
JSON request must be sent to GCM Notification
endpoint. The notification key for a users device is only
stored on the server. This feature can be used with
either the XMPP or HTTP connection server. The Figure
shows how communication works with CCS console:

Figure 6 GCM User Notification using CCS (Cambell, 2013)

124

CASEmobile

To use these feature developers can perform


generate/add/remove operations, and send upstream
messages. To send a message, the application server
issues a POST request to URL
https://android.googleapis.com/gcm/notifi
cation. And the following JSON format will be used:
//header, project ID API key for
authentication
content-type: "application/json"
Header : "project_id": <projectID>
Header: "Authorization", "key=API_KEY"
Request:
{
operation:[create,add,remove],
notification_key_name:user1_hash,
registration_ids:[XYZ, ABC]
}
Code 7 Request Format to work with notification key
operations
Here is a code example that shows targeting a
notification key for sending the message, which Bundle
data consists of a key/value pair:
GoogleCloudMessaging gcm =
GoogleCloudMessaging.get(context);
String to = NOTIFICATION_KEY;
AtomicInteger msgId = new
AtomicInteger();
Bundle data = new Bundle();
data.putString(26", case26);
gcm.send(to, id.toString(), data);
Code 8 Upstream messaging

4. VULNERABILITIES AND THREADS


Last year at the end of July, Kaspersky Lab, computer
Security Company, has announced that they have found
a backdoor in GCM service. Backdoor is defined as
method of bypassing normal access to a program,
online service or entire computer system, securing
illegal remote access to a computer, while attempting to
remain undetected. In our case, the backdoor can be
used by criminals to send SMS messages to premiumrate numbers, for stealing data from Android devices
and also to send messages which content includes links
to itself or other malware. Previously mentioned,
messages are sent in JSON format what enables
hackers to take advantage for malicious purposes. Once
gained a GCM ID, malware updates are distributed
exploiting directly the GCM services. Also the Command
to the malicious agent is sent is by exploiting the service
and using JSON format. Using GCM as Command and
Control server for Android Malware is already generally

known concept. The top three most Android Trojans that


used JSON format are listed below:
SMS.AndroidOS.OpFake.bo
SMS.AndroidOS.FakeInst.a
SMS.AndroidOS.OpFake.a
Trojan-SMS.AndroidOS.OfFake.bo is one of the most
sophisticated SMS Trojans. Its distinguishing features
are a well-designed interface and the greed of its
developers. When launched, it steals money from the
mobile devices owner from $9 to the entire amount in
the users account. There is also the risk of the users
telephone number being discredited, since the Trojan
can collect numbers from the contact list and send SMS
messages to all of those numbers. The malware targets
primarily Russian-speakers and users in CIS countries.
(Chebyshev and Unuchek, 2013)
Kaspersky Lab has reported Google about the
discovered vulnerabilities, and announced that the only
way to protect users against such attacks is through
blocking developers accounts with IDs linked to the
registration of malicious applications. The number of
malware that exploits the GCM service is relatively low.
Most malware are prevalent in Western Europe
(particularly in Russia) and Asia.

5. CONLUSION
This paper briefly introduced Google Cloud Messaging
for Android (GCM) which is defined as service that
allows developers to send data from 3rd party server to
their users' Android-powered devices, and also to
receive messages from devices on the same
connection. The GCM service handles all aspects of
queuing and delivery to the target Android application.
Key concepts of GCM are the components which make
the architecture of GCM and the credentials used for
access authentication in different stages of GCM.
Components include client app that runs on Android
device, 3rd-party app server and GCM connection
server. Credentials are the IDs and tokens used in
different stages of GCM (Sender ID, application ID,
registration ID, google user account and sender auth
token). GCM has many useful features such as: Send
to Sync and Send data capabilities, support for
multicast messages, delay while idle, and the use of
persistent connections (by using XMPP), the upstream
messaging and synchronization notification across
multiple android devices etc. The new CCS API for
GCM messages has made sending messages faster
than the HTTP API, but with the added complexity of an
asynchronous process. GCM is a great way for Android
developers to manage the communication with their
applications and users, but it also has important
disadvantages that should be taken in consideration.

References:
1

Android Developers, 2014a. GCM Overview [WWW Document]. Google Cloud Messaging - Overview. URL
http://developer.android.com/google/gcm/gcm.html (accessed 5.9.14).

Android Developers, 2014b. Implementing GCM Client [WWW Document]. Implementing GCM Client. URL
http://developer.android.com/google/gcm/client.html (accessed 5.9.14).

Android Developers, 2014c. Implementing GCM Server [WWW Document]. Implementing GCM Server. URL
http://developer.android.com/google/gcm/server.html#choose (accessed 5.12.14).

Cambell, A., 2013. Google Cloud Messaging: Cloud Connection Server Tutorial [WWW Document]. CapTech
consulting. URL http://captechconsulting.com/blog/antoine-campbell/google-cloud-messaging-cloud-connectionserver-tutorial (accessed 5.9.14).

CASEmobile

125

Chebyshev, V., Unuchek, R., 2013. Mobile Malware Evolution: 2013 - Securelist [WWW Document]. URL
http://www.securelist.com/en/analysis/204792326/Mobile_Malware_Evolution_2013?print_mode=1 (accessed
5.19.14).

freelancersnepal, 2014. Google Cloud Messaging (GCM) in Android using PHP Server. Freelancersnepal.

Google Developers, 2013. Google I/O 2013 [WWW Document]. Google I/O 2013. URL
https://developers.google.com/events/io/ (accessed 5.26.14).

HMKCode, 2014. Android Google Cloud Messaging Tutorial. Android Google Cloud Messaging Tutorial.

PushBots, 2012. PushBots: communicate with your mobile app users in minutes [WWW Document]. PushBots. URL
https://pushbots.com (accessed 5.26.14).

Information on authors:
Zoran Kos B.Sc
e-mail: zoran.kos@foi.hr
Zoran Kos is 2nd year student of Information and Programming engineering of Faculty of Organization and Informatics in
Varadin. Main interests are programming web, desktop and mobile application, new IT trends like cloud computing and
mobility, making and presenting business models for startup projects. While developing new apps he focused on front-end
development. He already has few smaller but successful projects behind him.
Zoran is the main contributor to this paper. He wrote the first version of the text and did coding of the presented examples.
Zlatko Stapi, PhD.
e-mail: zlatko.stapic@foi.hr
Faculty of Organization and Informatics
Pavlinska 2, 42000 Varadin, Tel: +385 42 390 820, Fax: +385 42 213 413
Zlatko Stapi, PhD., works at the Information Systems Development Department at Faculty of Organization and Informatics
in Varadin. He obtained his PhD in computer sciences from University of Alcal (Spain) and in information sciences from
University of Zagreb (Croatia) in cotutelled doctorate program. His scientific and research interests include software- and
mobile applications development methodologies. He participated in more than 15 scientific and professional projects and
published more than 30 scientific and professional papers. Currently he leads the Laboratory for Development and Transfer
of Mobile Technologies (FOI MT-Lab). Zlatko is putting a special focus in inclusion of students in his scientific and
professional activities. The published papers, projects, awards and other relevant information can be found on his personal
website: http://www.foi.unizg.hr/djelatnici/zlatko.stapic.
Zlatkos contributions to this paper are only of corrective nature. He mentored student Zoran Kos in defining the body, the
structure and the style of the paper. After the first version of the paper is written, he proof-read the text and made
necessary changes to make the text more focused and readable.

You might also like