1009 - Pocatilu

You might also like

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

106 Informatica Economică vol. 14, no.

3/2010

Developing Mobile Learning Applications for Android using Web Services

Paul POCATILU
Economic Informatics Department
Academy of Economic Studies, Bucharest, Romania
ppaul@ase.ro

The evolution of today's mobile devices increases the number of mobile applications devel-
oped, and among them the mobile learning applications. Mobile hardware and software plat-
forms allow running of faster and richer applications. This paper presents the main steps in
development of a distributed mobile learning application for Android. The client application
communicates with the server using Web services. The prototype developed includes the test-
ing module.
Keywords: Mobile Application, Android Operating System, Web Service

1 Introduction
Mobile learning applications are devel-
oped using various technologies and plat-
stored within the mobile device.
Distributed mobile learning applications (in-
cluding Web based) load and use the content
forms. Each implementation has specific cha- when they need it.
racteristics in terms of user interface and con- Distributed platforms have a similar architec-
tent and influences the development process. ture as Web-based platforms, but the client
A mobile learning system consists at least of application is a rich application and not a
the following components: simple mobile Web browser and the server is
 Mobile learning device; also different.
 Mobile learning software; The advantages of using this platform are:
 Mobile learning content.  Rich user interface;
The software required for mobile learning  Support for multimedia content;
process is a simple mobile Web browser or a  E-learning content can be easily updated
dedicated application, that can be standalone on the server;
or a client application. There are also some disadvantages:
The students' actions within an m-learning  The user need to install and setup the
system are to [2]: client application;
 Take online course;  The user have to learn how to use the ap-
 Take exams; plication;
 Send feedback;  Possible additional costs for traffic usage.
 Send homework, projects. The development of distributed mobile learn-
The trainers involved in e-learning solutions, ing applications involves the following steps:
including m-learning, are to:  Project Management;
 Deal with content management;  Analysis;
 Prepare tests;  Design;
 Assess tests, homework, projects taken  Implementation;
by students;  Testing.
 Send feedback; The steps are applied to software develop-
 Communicate with students (forums, e- ment and to mobile content.
mails and other type of messaging). The application development consider the re-
One of most used architecture for mobile sults obtained in [5] and [6] related to the
learning applications is Web based due to quality of mobile applications and systems.
well known technologies that are used. Figure 1 depicts the components involved in
Usually, standalone mobile applications need a distributed mobile learning system.
that all the mobile learning content to be In addition to mobile learning content, there
Informatica Economică vol. 14, no. 3/2010 107

are databases used to manage users, messag- lized modules are developed to provide:
es and other settings. Data stored in databas-  User control;
es is accessed from dedicated servers.  Content management;
The mobile learning application, developed  Courses;
for Android based devices, has the following  Tests;
modules:  Marks.
 Courses; The modules are written independently, and
 Quizzes; they share the common data. Each module
 Final and partial tests; has an associated screen and they are
 Messaging. launched from a main screen.
In order to administrate the system, specia-

Mobile
Application Internet/
Network
M-learning
content

Mobile/Desktop
Application

Web Services/
Web Server/
Application Servers User
management

Messaging
archive

Fig. 1. Distributed mobile learning platforms architecture

The communication between client and serv- in ICT. Android platform is an open source
er is based on Web services. XML Web ser- project, allowing its amendment by any man-
vices have many advantages for developers ufacturer of mobile devices.
and for users: they use simple protocols and Figure 2 depicts the architecture of Android
the implementation of the services and operating system.
clients is easier than other methods. The operating system is based on Linux ker-
The prototype developed up to now imple- nel version 2.6.x, that is a monolithic kernel.
ments the quizzes module. The kernel includes drivers for the mobile
device hardware: screen, keyboard, camera,
2 Android Platform USB, Bluetooth etc. Kernel provides inter-
2.1 Android Operating System face hardware and memory management,
Android operating system is a project in- processes and other resources.
itiated by Google through the Open Handset
Alliance, which includes over 30 companies
108 Informatica Economică vol. 14, no. 3/2010

Applications and Widgets each application running in a separate thread.

Application Programming Interface 2.2 Android Application Development


Android applications are developed using
Libraries Android runtime one or more basic components [3], [4]:
 activities (Activity base class),
Linux Kernel and Drivers  services (base class Services),
Hardware  content providers (ContentProvider
base class)
Fig. 2. Android Architecture  components that receive and act on mes-
sages sent to all applications (the base
Native libraries on the next level are depen- class BroadcastReceiver)
dent on hardware architecture of the mobile  messages (class Intent)
device. These libraries include support for A particular importance in application devel-
2D and 3D graphics (Single, OpenGL ES), opment is the resources that enable separa-
multimedia, security, storage, browsing tion of interface code.
(WebKit) and standard C library [8]. Activities represent the screen associated to
Android applications are developed using Ja- an application. An application can have one
va programming language. Applications re- or more activities.
quire an environment to manage their life- Services are routines that run in parallel with
cycle. This includes a Java virtual machine the main thread and do not have GUI. They
(called Dalvik virtual machine) and Java allow the development of actions in the
class libraries that provide basic support for background without blocking the main thread
applications (collections, input/output opera- execution and interaction with such applica-
tions management etc.). Android applications tion.
are not compatible with Java ME or Java SE. Content providers are used for sharing data
The applications are optimized for mobile between applications. Data sharing is done
devices constraints. through files, databases or other means. An
The application programming interface al- alternative to content providers is the use of
lows accessing a framework that includes communication between processes.
components used by all Android applica- Applications can respond to the occurrence
tions. The application framework includes of events in the system by using classes de-
components for Android application man- rived from BroadcastReceiver. They do
agement (installation, execution), windows not GUI and an application can have several
management and user interface graphical, components of this type.
event handling etc. In order to activate components like activi-
Application level includes pre-installed ap- ties, asynchronous messages encapsulated in
plications (contact management, phone, ca-
objects of Intent type are used.
lendar, Internet browser) and user applica-
Android applications are developed mainly
tions. Applications are based on Java tech-
using Eclipse IDE with Android Develop-
nologies and use classes provided through
ment Tools (ADT) plug-in. Android SDK
application programming interface. In addi-
and emulators are necessary for application
tion, there is the possibility to use native
development.
functions in programs written in C/C++ pro-
gramming language through NDK (Native
3 Graphical User Interface
Development Kit).
The prototype developed consists of three ac-
Widgets unlike applications, occupies only
tivities:
part of the main display screen and asso-
 Test selection;
ciated (Home).
 Question and answers;
Android operating system is multitasking,
 Answers list.
Informatica Economică vol. 14, no. 3/2010 109

The interface is simple and intuitive, without is ActTeste and is declared as the main activi-
any graphics and drawings. That will reduce ty in AndroidManifest.xml configuration file.
the amount of memory required by the appli- When the application is launched, the list of
cation and reduces the time of development. tests is automatically loaded in this screen.
Future versions will include de redesigned The list is an object of ListView type.
and friendlier user interface. The application The description of list elements is defined in
targets the mobile devices with touch screen, a resource file based on XML. For the exam-
but is not limited to. ple from Figure 3 the following structure was
The main screen for the quizzes module is used for each list element:
presented in Figure 3. The associated activity
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
/>

Manifest.xml, a runtime exception will occur


when the code is executed.
All the available tests are loaded from a da-
tabase stored on the server side. A dedicated
Web service method is used for this initial
action.
The main menu includes items that allow to:
 Login/Logout the application;
 Exit the application;
 View application version.
The main menu options are added when
onCreateOptionsMenu method is called:

public boolean
onCreateOptionsMenu(Menu menu)
{
menu.add(0, LOGIN, 0, "Login");
menu.add(0, LOGOUT, 1, "Logout");
menu.add(0,IESIRE, 2,"Iesire");
menu.add(0,DESPRE, 3,"Despre");

return true;
}

When the user selects a menu item


Fig. 3. Test selection screen on an Android onOptionsItemSelected function is called.
device For example, when user want to exit from the
application, the code associated with IESIRE
In order to start a new activity, an Intent in- label is executed:
stance is used. All activities need to be de-
public boolean onOptionsItemSelected
clared in AndroidManifest.xml file: (MenuItem item)
<activity android:name=".ActTeste" /> {
<activity android:name=".ActIntreb"/>
<activity android:name=".ActRasp"/> switch (item.getItemId())
{
//...
If the activities are not declared in Android- case IESIRE:
110 Informatica Economică vol. 14, no. 3/2010

android.os.Process.killProcess The following code is used to show the activ-


(android.os.Process.myPid());
ity associated with questions and answers,
return true;
} based on Adapter-
View.OnItemClickListener interface:
return false;
}

public void onItemClick(AdapterView<?> parent, View item, int position,


long id)
{
Intent intent = new Intent(ActTeste.this, ActIntreb.class);
//add parameters
intent.putExtra("idTest", position + 1);
//launch selected test
startActivity(intent);
}

When the user selects a test from the list, the public boolean onPrepareOptionsMe-
nu(Menu menu)
screen associated to the first question will be
{
shown. Figure 4 illustrate the graphical inter- if (idIntrebareCurenta ==
face associated to the question window. numarIntrebari)
menu.setGroupEnabled(
ActIntreb.INAINTE, false);
else
menu.setGroupEnabled(
ActIntreb.INAINTE, true);
//…
}

In order to pass complex objects from an ac-


tivity to another, they have to implement the
interface android.os.Parcelable through
the methods describeContents and writeTo-
Parcel.
For example, the class Intrebare, that
represents a question, implements the write-
ToParcel method in this way:

public void writeToParcel(Parcel


dest, int flags)
{
dest.writeInt(idIntrebare);
dest.writeString(text);
dest.writeStringArray(var);
}

The class must include a static field named


Fig. 4. Question screen as shown on an An-
CREATOR:
droid device
public static final Parcela-
The questions have only one correct answer. ble.Creator<Intrebare> CREATOR =
The student can navigate sequentially from new Parcela-
one question to another. Some menu items ble.Creator<Intrebare>()
{
are disabled for the first or the last question: ...
}
Informatica Economică vol. 14, no. 3/2010 111

used when Intrebare objects are created using The student has the possibility to review the
this method. answers and to calculate her or his score.
At the end, the student can review the an- Because the answers are stored in a HashMap
swers and send them to the server in order to and the questions need to be shown sorted by
monitor the progress. question code, the class Intrebare imple-
ments the Comparable<Intrebare> inter-
face.

4 Web Services
The Web service used by this application has
been developed using Microsoft .NET tech-
nologies. The Web service provides several
Web methods that are used by this mobile
learning application.
The use of Web services provide a very flex-
ible way for client applications that can be
developed on almost any mobile or desktop
platform.
The GetNumarIntrebariTest method re-
turns the number of questions of a given test
identified through a code. The number of
questions is taken from the database.
If an exception occurs, the method will return
a negative value.
The following code is an example of a me-
thod used in this Web service:

Fig. 5. Answers verification lists as shown on


an Android device
[WebMethod]
public int GetNumarIntrebariTest(int idTest)
{
OleDbConnection conn = new OleDbConnection(connString +
Context.Request.PhysicalApplicationPath + dbString);

OleDbCommand cmd = new OleDbCommand();


cmd.Connection = conn;
cmd.CommandText = "SELECT COUNT(*) FROM Grile WHERE id_test = " +
idTest;

int nrIntrebari = -1;

try
{
conn.Open();
nrIntrebari = (int)cmd.ExecuteScalar();
}
catch (Exception ex)
{
nrIntrebari = -1;
}
finally
112 Informatica Economică vol. 14, no. 3/2010

{
conn.Close();
}

return nrIntrebari;
}

The Web services are consumed using a added to the envelope body (using SoapOb-
third-party library distributed as free source ject class).
kSOAP2 (http://ksoap2.sourceforge.net/), The HttpTransportSE class is used to make
optimized for Android. the actual call of the Web service method, the
The libraries need to be added to the project envelope being passed as parameter. The re-
in order to be used. This library is based on sult is retrieving from the response part of the
the SOAP architecture and there is no need to envelope.
generate a proxy/stub to call Web services The getIntrebare function is used to access
methods. the Web service and to call a specific method
A SOAP envelope is created using the Soap- used to get the specified question. The func-
SerializationEnvelope class (specifying tion's source code is:
the SOAP version) and the request details are
public static Intrebare getIntrebare(int idTest, int idIntrebare)
{

Intrebare intrebare = new Intrebare();

try
{
SoapObject request = new SoapObject(NAMESPACE, GET_INTREBARE);

// add paramaters and values


request.addProperty("idTest", idTest);
request.addProperty("idIntrebare", idIntrebare);

SoapSerializationEnvelope envelope =
new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);

HttpTransportSE androidHttpTransport =
new HttpTransportSE(URL_WS);
androidHttpTransport.call(NAMESPACE + GET_INTREBARE, envelope);

SoapObject result = (SoapObject) envelope.getResponse();

//question initialization
intrebare.setIdIntrebare(Integer.parseInt(result.getProperty(
"IdIntrebare").toString()));
intrebare.setText(result.getProperty("Text").toString());
SoapObject variante = (SoapObject) result.getProperty("Var");

for (int i = 0; i < Intrebare.VARIANTE; i++)


intrebare.setVarianta(i,
variante.getProperty(i).toString());

}
catch (Exception e)
{
e.printStackTrace();
Informatica Economică vol. 14, no. 3/2010 113

intrebare = null;
return intrebare;
}

return intrebare;
}

It is very important to send the right parame- usage:


ters to the methods. In this example, the pa-
intrebare = AccesSW.getIntrebare
rameters used in these calls are initialized as
(idTest, idIntrebareCurenta);
follows:
 NAMESPACE = "http://tempuri.org/";
In order to use Web services the application
– Web service namespace; in this exam- needs special permission. Permissions are
ple the default namespace is used stored in AndroidManifest.xml file. For this
 URL_WS =
mobile application, the following line has to
"http://server/Service.asmx"; – be added:
Web service URL
 GET_INTREBARE = "GetIntrebare"; – <uses-permission andro-
Web service method name id:name="android.permission.INTERNET
 idTest, idIntrebare – the parameters "></uses-permission>
used by GetIntrebare method
Using wrong values for these parameters will In this prototype, all data is stored in memo-
lead to Web service method call to fail. ry, during program execution. All loaded
All the functions used to access the Web ser- questions and given answers are saved in or-
vice are included in a class, in order to be ac- der to reduce costs related to data transfer
cessible from anywhere within the package. through wireless networks:
This is an example of this Web method

Vector<Intrebare> intrebari = new Vector<Intrebare>();


Hashtable<Intrebare, Raspuns> raspunsuri = new Hashtable<Intrebare,
Raspuns>();

For the future versions the following me- applications is very important and challeng-
thods will be taken into account: ing compared with stand alone applications.
 Local files; There are several areas where the security re-
 Property files; quirements are high and they need special at-
 Local databases. tention.
Table 1 presents some security concerns re-
5 Security Issues garding the mobile learning solutions, based
The security of distributed mobile learning on [7].

Table 1. Security concerns of m-learning applications


Action Security requirements
Online exams High
Content management Medium-High
Feedback management (forums) Low-Medium
Homework/Projects Assessment High
Quizzes Medium
User management High

These issues can be managed using several methods and techniques like:
114 Informatica Economică vol. 14, no. 3/2010

 different authentication levels;  Courses and Tests modules implementa-


 password management; tion,
 data encryption;  user management,
 location services.  modules integration,
Each of actions from Table 1 requires a cer- in order to provide a basis for an working m-
tain degree of security, depending on the im- learning application.
portance and data sensitivity. This prototype is a part of an m-learning sys-
The databases with tests, marks and users tem that will also be developed for other mo-
contain sensitive data and they need a special bile platforms in order to cover a wide area
attention. of mobile devices and users.
The security requirements for examinations,
homework/project assessment and user man- Acknowledgements
agement are very high due to the importance This work was supported by CNCSIS –
of data and information they use. UEFISCSU, project number PNII – IDEI
Quizzes and content management have me- 2637/2008, project title: Project management
dium security requirements, because the data methodologies for the development of mobile
manipulated is less sensitive. applications in the educational system.
Feedback management and messaging for
these systems does not use sensitive data. References
The minimum requirement is to use authenti- [1] D. S. Metcalf II and J. M. De Marco,
cation through users and passwords. mLearning: Mobile Learning and Perfor-
Wireless data communication can be easily mance in the Palm of Your Hand, HRD
monitored, so high security need to be as- Press, Inc., 2006.
sured by using specific standards. [2] P. Pocatilu, F. Alecu and M. Vetrici,
Application testing has to include several se- Measuring the Efficiency of Cloud Com-
curity tests. puting for E-learning Systems, WSEAS
TRANSACTIONS on COMPUTERS, Issue
6 Conclusions and Future Work 1, Volume 9, January 2010, pp. 42-51.
The development of mobile applications is [3] E. Burnette, Hello, Android: Introducing
not an easy task. There is a variety of plat- Google’s Mobile Development Platform,
forms and technologies to choose from. Mo- 2nd Edition, The Pragmatic Bookshelf,
bile devices resources are limited. User expe- 2009.
rience with mobile devices and software is [4] R. Meier, Professional Android 2 Appli-
various. cation Development, Wiley Publishing,
Using Web services for mobile learning ap- Inc., 2010.
plications helps the process of development [5] C. Ciurea, "A Metrics Approach for Col-
by providing a standardized way of commu- laborative Systems," Informatica Econo-
nication between mobile clients and servers. mica, vol. 13, no. 2/2009, pp. 41-49.
There are also drawbacks that need to be re- [6] C. Boja, L Batagan, “Analysis of M-
duced or eliminated: Learning Applications Quality,” WSEAS
 data volume (optimization); TRANSACTIONS on COMPUTERS, Issue
 security (discover and eliminate security 4, Vol. 8, May 2009, ISSN 1109-2750,
holes); pp. 767-777.
 data serialization for custom and complex [7] F. Alecu, P. Pocatilu and S. Capisizu,
objects (refactoring). WiMAX Security Issues in E-Learning
Regarding the presented mobile application, Systems, Proc. of 2nd International Con-
the following development directions are ference on Security for IT & C in Journal
considered: of Information Technology and Commu-
 new functionalities, nication Security, Bucharest, November
 interface improvement, 2009, pp. 45-52.
Informatica Economică vol. 14, no. 3/2010 115

[8] The Developer's Guide | Android Develop- http://developer.android.com/guide/index.h


ers [Online]. Available at: tml (March 2010).

Paul POCATILU graduated the Faculty of Cybernetics, Statistics and Eco-


nomic Informatics in 1998. He achieved the PhD in Economics in 2003 with
thesis on Software Testing Cost Assessment Models. He has published as au-
thor and co-author over 45 articles in journals and over 40 articles on national
and international conferences. He is author and co-author of 10 books, (Soft-
ware Testing Costs, and Object Oriented Software Testing are two of them).
He is associate professor in the Department of Economic Informatics of the
Academy of Economic Studies, Bucharest. He teaches courses, seminars and laboratories on
Mobile Devices Programming, Economic Informatics, Computer Programming and Project
Management to graduate and postgraduate students. His current research areas are software
testing, software quality, project management, and mobile application development.

You might also like