Académique Documents
Professionnel Documents
Culture Documents
2015
i
ACKNOWLEDGEMENT
I thank my family for their help during my study, Dr.Ghodrat Moghadampour, for
his time and patience and for teaching me several software courses including the
Android programming. I also thank all the instructors who have been helping me
all through my study time.
Beside my supervisor, I would like to thank Vaasa Summer University who orga-
nized VAMK special programming courses during the spring and summer since
the Android Programming is a course that helped me to do my thesis.
ii
VAASAN AMMATTIKORKEAKOULU
UNIVERSITY OF APPLIED SCIENCES
Degree Program in Information Technology
ABSTRACT
The objective of this project was to develop an Android mobile application which
allows teachers and students to use the application anywhere using an Android
phone or tablets. The application allows the teachers to login, add major course
information, edit the existing course information, search a student and add a stu-
dent to a course. On the other hand, the applications allow students to login,
search and enroll to a course and also view their current course histories.
In achieving the objective of this project, the following three major parts were de-
signed and implemented. Firstly, the design of the graphical user interface was
implemented. Secondly, a MYSQL database that connects and communicates with
the PHP was designed to store the student, teacher and course data. Thirdly, the
PHP scripts were written and stored in online server that is used to retrieve data
from the database.
TABLE OF CONTENTS
ACKNOWLEDGEMENT ....................................................................................... I
LIST OF ABBREVIATIONS .................................................................................V
1 INTRODUCTION ............................................................................................ 9
2 RELEVANT TECHNOLOGIES.................................................................... 10
2.1 Application Structure .............................................................................. 10
2.2 Application requirements ........................................................................ 11
2.2.1 Android ....................................................................................... 11
2.2.2 JSON ........................................................................................... 12
2.2.3 MySQL Database ........................................................................ 12
2.2.4 PHP ............................................................................................. 12
2.3 The Application Development Environment .......................................... 12
2.3.1 Installation of Eclipse IDE .......................................................... 13
2.3.2 Installation of Android SDK ....................................................... 13
2.3.3 Installation of Android Development Tools ............................... 13
2.3.4 Installation of Android Virtual Device ....................................... 14
2.4 Android Phone Application Development .............................................. 14
3 APPLICATION DESCRIPTIONS ................................................................. 16
3.1 Quality Function Deployment................................................................. 16
3.1.1 Normal Requirements (Must Have) ............................................ 16
3.1.2 Expected Requirements (Should Have) ...................................... 17
3.1.3 Optional Requirements (Nice to Have) ....................................... 17
3.2 Use Case Diagram................................................................................... 17
3.2.1 Student Use Case ........................................................................ 17
The student has the following sets of use cases in detail. ....................... 18
3.2.2 Student Login Review use Case .................................................. 18
3.2.3 Enroll Course Use Case ............................................................... 19
3.2.4 View Participation Use Case ........................................................ 20
3.2.5 Retake Exams Use Case ............................................................... 20
3.2.6 Teacher Use Case Diagram ......................................................... 21
3.2.7 Teacher Login Use Case ............................................................. 22
iv
LIST OF ABBREVIATIONS
OS Operating System
IP Internet Protocol
IOS Iphone OS
ER Entity Relationship
Code Snippet 9. Get course list class in enroll Course Activity p.55
1 INTRODUCTION
The Computer has been in constant evolution: the computer gets smaller in size
continuously; modern computers can save a huge amount of data and can handle
advanced programs. In 2008 Apple released their I-Phone that led to the new type
of communication device using Apple operating system /1/. Applications are typi-
cally operated by the owner of the mobile operating system, such as Google Play,
Apple App Store and Window Phone Store.
One of the giant operating systems which compute with Apple is Android mobile
operating system (OS).Android is a based on the Linux kernel and de-signed pri-
marily for touch screen mobile devices, such as smart phones and tablet comput-
ers, and is currently developed by Google. Recently some devices like cars, televi-
sions, wrist watches and refrigerators are running Android application with spe-
cialized user interfaces. The reason what makes many devices popular is that they
are easy to use, free, and customizable and they works with all Google applica-
tions.
Android versions have been developed from the first commercial version, An-
droid 1.0 which was released in 2008 to the current Android 5.0. Each of the
versions has a code name released in alphabetic order from Alpha (1.0) to Lol-
lipop (5.0) under ongoing development by Google and the Open OHA. /2/
This project targets to an application that the students and teachers can use more
frequently rather than using a computer .By using the mobile application users can
easily track the courses history at any time using a mobile or tablet.
This allows course histories to be uploaded to a central server where the data can
be shared with all other Android users in the group depending on the privilege.
Using Android’s internet capabilities, the application communicates with the ap-
plication server. The application has a server side part designed and implemented
in PHP, which sends and receives data from a MySQL database.
10
2 RELEVANT TECHNOLOGIES
The mobile application provides a user friendly interface for the user’s .The pro-
ject is composed of two main major parts which are client side and server side. In
this project the Android application cannot communicate with a remote MYSQL
database directly. Therefore, PHP is included which helps to communicate and
allows to edit and execute scripts and interactive interpreters directly on the An-
droid device. The Android application calls a PHP script in order to perform a da-
ta operation, let’s say “add course”. The PHP script then connects to the MYSQL
database to perform the operation. So the data goes from the Android application
to the PHP script, and then finally is stored in the MYSQL database.
Below is a diagram of the system which illustrates the interactions between the
server and client side applications.
The application is made in a way that to get the required data from a remote serv-
er whenever there is only an Internet connection. So users cannot use this applica-
tion if there is no Internet connection in their device.
Android applications are developed using the Java language which is a very popu-
lar programming language developed by Sun Microsystems /3/. Some of the Ja-
va’s important major features are that it is easy to learn and understand, it is ob-
ject-oriented, designed to be platform-independent and secure. Android relies
heavily on these Java fundamentals.
12
2.2.2 JSON
JSON stands for JavaScript object notation, which is format of data, used to send
and retrieve data on the Internet. It is a lightweight data-interchange format that is
easy to understand, write and read and also it is easy for machines to parse and
generate. It is used to transmit data between a server and web application as to
substitute XML in most applications.
Although originally derived from the JavaScript scripting language it has a data
format that does not directly depend on the language. The code for parsing and
generating JSON data is available in many programming languages. /4/
2.2.4 PHP
In order to achieve the objective of the project, a right working environment was
needed. Therefore, the following software tools are required to set up the envi-
ronment for developing Android applications.
13
To develop an Android application, developers need to make sure that the de-
velopment environment has the recent Java versions or above Java 5. Since
Java is operating system independent, the developer can freely choose the devel-
oping environment for their right operating system. In order to make this project
the tools listed below should be installed on the computer. The installation of the
tools is also described.
For the Android programming the Eclipse IDE for Java EE Developers can be
used, which is a multi-language software development environment featuring an
extensible plug-in system. It is available and should be downloaded from the link
(https://eclipse.org/downloads/).Once Eclipse IDE was downloaded a directory for
the project was created and the downloaded Eclipse was put inside the directory
created.
The next step in setting up the development environment is to create Android Vir-
tual Devices (AVDs) to be used during the development process. An AVD is an
emulator instance that enables modeling an actual device.
Different AVDs can be created in order to test applications with different configu-
rations which help the developer to observe the nature of the application on differ-
ent devices with varying capabilities.
The Setup Phase is the phase where it is important to provide the Android work-
ing environment by downloading the necessary tools .In addition the AVD’s
should be set up in order to test the application during the development phase.
The Development phase is when the application is built with our own source
codes.
15
Debugging and Testing is the phase where the application is built and run in the
debug mode and it will be confirmed also that the application is ready after it has
been tested. The last phase is publishing the application which helps the users to
use the application after it has been published in the market. The following figures
describe the details.
3 APPLICATION DESCRIPTIONS
In this section explanation is given to the detailed description of the project and
requirements. The scope of the project encompasses both server- and client-side
functionalities, so the client side is covered in detail within this section
The following list offers a brief outline and description of the main features and
functionalities of the system. The features are split into three major categories:
Must have, Should have and Nice to have. Must have or Core features are essen-
tial to the application’s operation, whereas Nice to have or additional features
simply add new functionalities.
The application should be user friendly .Users should be able to login easily and
proceed to deal with the important features on the application. Therefore, user log-
in page for the username and password should be included inside the application.
A student can view the grade for the course, a teacher can mark grade for the
courses and the application let the user can view academic schedule.
A use case describes how a system acts and responds to inputs by the primary
actors. The student and the instructor have their own page to login. They should
use the preregistered username and password for authentication which authorizes
them to have access to all features on the application. In this project we cannot
register any new student or teacher from this application. It can be done from the
server side or the administrator can add a new user since the administrator has ac-
cess to all the information of the registered users. All the necessary user infor-
mation is stored on online database. PHP is written and stored on online server
that is used later to fetch the required data.
The following figure shows all the main activities of the Student use cases.
18
Login
Student
Brief Description
The student logs in with his/her own user name and password.
Before this use case can be initiated, the Student has already connected to the
Website.
1. The student types his user name and password and press login button.
2. The System checks if it is a correct name and password.
3. The System generates and sends an email acknowledgement.
Enroll Course
Student
Brief Description
The student chooses and registers into a course from the available list of courses.
Before this use case can be initiated, the student has already accessed the main
page of the register.
View Participation
Student
Brief Description
Before this use case can be initiated, the student has already accessed the main
page of the Register .
Brief Description
Before this use case can be initiated, the student has already accessed the main
page of the Register .
Student
The actor in the following set of use case is the teacher that performs all the ac-
tions that trigger an event in the teacher side user interface. In Figure 8, the main
possible activities in the use case diagram of the teacher are presented and later
each use case is presented in detail.
22
The teachers have the following set of use cases. In Figure 9 the teacher login use
case is presented.
Login
Teacher
Brief Description
The teacher logs in with the user name and password.
23
Before this use case can be initiated, the teacher has already connected to the main
page.
1. The teacher types his user name and password and presses login button.
2. The system checks if it is a correct name and password and if the teacher has
typed correctly, then Add course and View participation come up.
3. The system generates and sends an email acknowledgement.
Add Course
Teacher
Brief Description
The teacher adds course and enters a new course name, course code and course
finishing date.
Before this use case can be initiated, the teacher has already accessed the main
page of the register.
3. After the teacher has added a course, the system presents options for the
teacher to add and cancel.
4. The teacher selects and the system verifies the information and returns the
teacher to the teacher main page.
3.2.9 Teacher Edit Course Use Case
Edit Course
Teacher
Brief Description
Before this use case can be initiated, the teacher has already accessed the main
page of the Teacher.
Add a student
Teacher
Brief Description
Before this use case can be initiated, the teacher has already accessed the main
page of the teacher.
1. The system presents the list of active courses and student lists.
2. The teacher chooses a course.
3. The system presents the students enrolled to the chosen course.
4. The teacher views the information and clicks Add student to a course.
5. The system verifies the information and returns the teacher to the main page.
be easily seen that the username and password is checked if it exists already in the
database for further feature of the application to proceed.
Figure 14 presents the login sequence through which the teacher accesses the
main teacher page interface. The main menu teacher page contains the important
features of the teacher side application.
27
The class diagram which is also one of the most popular UML diagrams shows a
collection of classes, interfaces, associations, collaborations and constraints. The
purpose of the class diagram is to analyze and design the static view of an applica-
tion. The class diagrams are the only diagrams which can be directly mapped with
object oriented languages and thus widely used at the time of construction /10/
.Figure 15 describes the declaration of each parameter of different classes and
shows the relation among the classes that are used inside the student package.
28
In the above figure it is shown that course, Enroll to Course Activity, Enroll to
Exam Activity View Registered Courses are identified as the main elements of the
system and their relationship is shown between these elements. For example
Course and Enroll to Course Activity have a one-to-many relationship because a
course can be called by one or many enroll to course activity.
29
4 DATABASE
This application basically uses the database on online server. Therefore, the
database that is used to store and retrieve data records is found in the remote
school server ( www.mysql.cc.puv.fi). For this application, a database named
the 0800841_e0800841 was created.
After creating the database, it is also important to create the database tables.
The database consists of six tables. These are student, teacher, course, enroll-
ment, enrollment for exam and retake exam tables. Each table has its own at-
tributes that are restricted by possible values of the domain and we also need
to have relationships between these tables. For instance, teachers add a course,
and a course is enrolled by students. These relationships need to be represent-
ed in the database. Also, when fetching data with SQL which are written in-
side the PHP script in this project, certain types of JOIN queries need to be
used to get the information needed. The relationships between the tables are as
shown in Figure 16 diagram below.
30
In the above Figure 16 it is shown that the teacher table with primary key teach-
er_id has a one-to-many relationship with the course table that has a primary key
course_id. The relationship between these tables is designed on the idea that
teacher can have multiple courses.
The student table with the primary key student_id has many-to-many relationship
with the course table. In a many-to-many relationship; one or more rows in a stu-
dent table can be related to 0, 1 or many rows in course table. Therefore, each row
in student table is linked to 0, 1 or many rows course table and vice versa. Since in
31
When the server name, the database name, the password and username that have
used for making the database are known then it is possible to start writing the PHP
script. These fields will be required for making the PHP script that will be used
for login.php.
The user inputs his username and password (in case of login) and presses the login
button. The Android application calls a URL:
http://www.cc.puv.fi/~e0800841/android/login.php on calling the URL, a PHP
script runs, that receives the data that has been sent from the Android application,
with the method called POST.
After that the PHP script runs query to the database and compares the username
and password with already existing username and password in the database. If the
result is true, it will output its data with a value of true in the JSON format. Once
the returned data is true, the user application will then move to the next activity
that is to be shown to the user. In case the user login information is invalid an er-
ror message is sent to the user that the information that he enters is invalid.
32
This chapter provides an overview of the user interface. The easiest mechanism
for designing a user interface for an Android application is using editing and writ-
ing XML files.
The Launch page was the first page which will be displayed every time when-
ever we want to use the application. There are two buttons which lead the
teacher or student to choose their own page.
At this stage the page was not linked to server. It will only guide the student
or teacher to choose page for authentication.
The login page interface was designed using android xml. It allows the stu-
33
The page was designed in such a way that all the information that was entered
here is checked on the remote database before it proceeds to the next page. It con-
sists of two buttons (login and cancel) and the buttons have clickable attributes
which help the buttons to do an action whenever it is clicked. In this page the stu-
dent should fill the necessary information in order to proceed to the next page.
The Student Menu list page contains all the important features of the student side
application. This was designed using xml. The following figure shows how the
student home page looks after the student has logged in on the authentication
page.
34
The page is the communication link between the student and application. The stu-
dent will be able to access the features by clicking on the buttons on the menu list
page. These four buttons are: Participations, Enroll, Retake Exams and Logout.
These buttons are the most important buttons for the student to provide the medi-
um to interact with the student side features of the application. Clicking these but-
tons leads to other pages of the application. The function of the buttons is de-
scribed down below in detail.
5.2.2 Participations
When Participation button is clicked, it displays the list of enrolled courses. The
application will display the list of enrolled courses. Once the courses are enrolled,
the application should be able to display the courses. The following figure illus-
trates this.
35
5.2.3 Enroll
This button is linked to a function, which displays the list of available courses.
The application will display the available courses. Once the courses are displayed,
the student can choose the course he wants to register. The following figure illus-
trates the view after the Enroll button has been clicked from the student Main
page.
36
Students can view and register into courses that are available to take in that cur-
rent semester or period.
In addition, if the user selects the course and clicks the enroll button, then the
course will be added to the list of enrolled courses and can be viewed later when
the user click the Participations button from the main student page. And if the stu-
dent clicks the cancel button then the application will direct the student to the stu-
dent main page.
37
The teacher login page was designed using xml. It allows the teachers to enter
their registered username and password. The page was made the same way as the
student login page. It was designed in such a way that it does not accept null vari-
ables or wrong combinations. It consists of two buttons (login and cancel) and the
buttons have clickable attributes which help the buttons to do an action whenever
it is clicked. On this page the teacher should fill the necessary information in order
to proceed to the next page. Figure 22 is the page which appears when the teacher
wants to login.
The Teacher Menu list page contains all the buttons which lead to the important
features of the teacher side application. There are four buttons which lead the
teacher to other pages as shown in the diagram below. The following figure shows
how the teacher home page looks like after the teacher has logged on with the au-
thentication page.
38
The page is the communication link between the teacher and application. The
teacher will be able to access the main features by clicking on the buttons of the
teacher main menu page.
These four buttons are: View courses, Add course, Edit course and logout .These
buttons are the most important buttons for the teacher to provide the medium to
interact with the teacher side application. When these buttons are clicked, it leads
to other pages of the application. The function of the buttons is described down
below in detail.
39
This button is linked called in a class, which displays the list of courses given by
the teacher. The application will display the list of courses and on this page the
teacher can make some minor changes in the course details, for example, the
course name, course id or course description. The teacher can do it easily in this
application and the changes will be directly updated in the database. Figure 24
illustrates when the View courses button is clicked.
In addition, if the teacher clicks on the student lists button it is linked to a class
that brings an environment for the teacher to view the list of students taking that
particular course. Figure 25 below shows how the button appears during this
event.
40
On this page the teacher can add new courses that will be given to the students in
the current period or the coming period. It was built in a way that the teacher can
add the course major details which are course name, course id and course date.
This button is linked to the Add course class, which displays editable text views
for important course details. The three editable text views are course name, course
ID and Course description. When the Add course button is clicked on the teacher
main page, the application displays a page with editable Text Area for the user to
enter a valid course details shown in Figure 27 below.
41
In addition, if the teacher adds the right information on the course details and
clicks the submit button, a new activity, which saves a full description of the
course details will be launched and will store the data in the database. If the
teacher clicks the cancel button then the application will direct to the teacher main
page.
42
6 TESTING
Testing can provide an objective that the application meets the requirements that
guided its design and development responds correctly to all kinds of inputs and
ensure the correct functionality of the application. The testing done in the Client
side of the application was carried out on a Samsung Galaxy S4 phone.
To view the main features of the application, the username and password should
be given as shown in Figure 27. In the case of inputting invalid login credentials
(missing data or wrong username and password combination), the application will
not proceed to the main page, instead the application will display error messages
that ask the user to enter the missing data or the correct user credentials.
As shown in Figure 28, the student touches the buttons in order to get the desired
feature of the application.
Test: Participation
When the Participation button which is shown in Figure 29 is pressed, then the
following page which is shown in figure 30 will be displayed. This test case is
carried out assuming that a student has already registered for few courses.
44
On this page, as shown in Figure 31, the user can also undo the enrollment by
pressing Unenroll course button.
Figure 30 illustrates the situation when Enroll to courses button is pressed .The
student chooses the desired course and clicks Enroll button in order to register into
a course.
46
7 IMPLEMENTATION
In order to use these application users should first login to access the main fea-
tures of the application. When the user clicks the login button in order to login, the
first thing that happens during the login process is that the required necessary
fields are checked. If the required fields are empty that will be checked without
sending the parameters to the server. If the user enters the username and pass-
word, then it will be checked, if the user is already registered in the database. The
following code snippet is taken from the student login page which was designed
by xml .In the diagram it is shown that this graphical interface consists of two but-
tons (login and cancel), two text views (Username and Password) and also two
edit text views (for username and password).
47
The user inputs the right username and password and clicks the login button. The
following code snippet 2 is taken from the main student activity class. It shows
that the btnlogin from the student login xml is declared as loginBtn and assigned
by calling setOnClickListener(View.OnClickListener) .
48
The setOnClickListener will attach the login button on the activity using the
OnClickListener interface that responds to a call back method onClick when
clicked.
The following code snippet shows that if the user types only the username and
clicks the login button then the application will display an error message which
states that “Password field is required!”.In addition, it will display the error mes-
sage for the other fields as well as shown clearly inside the code. If the user enters
the right username and password then the loginProcess class is called for the login
process.
49
In the login process class the parameters are built to get the user details by making
an HTTP request. The PHP code which stored in online server interacts with the
database in order to implement the validation. The script returns ‘1’ if the
username and password entered by the user from the mobile phone are the same
as the one in the Users table in the database. The following code snippet shows
what method is done when this login process class is called.
50
On the other hand, if the user enters wrong password or username, the PHP script
returns ‘0’ and the GUI display, “Incorrect Username or Password”. The user is
then offered another chance to re-enter the password and the username.
This class belongs to the student course package. It displays to the student the list
of enrolled courses. The following code snippet is taken from the code. Firstly the
parameters are built with the right student id and then it gets the course details by
51
making an HTTP request to JSON. Later if the JSON response is successful, then
it loops through all the courses and stores each JSON item in variable, then it will
add them to the array list which can be displayed in the GUI.
This class belongs to the teacher course package and consists of methods which
add courses to the system. The values that the teacher inserts from the GUI are
assigned to the variables shown in Code snippet 7 and later used to build the pa-
rameters.
After the course details are assigned, and then it adds the course details by making
an HTTP request using the post method. Then if the JSON response is successful,
then a course is successfully created.
53
The following codes are some functions that were used in this activity that is
shown in the Code snippet. It shows the task to enroll students to the course by
taking their student ids as parameter of the PHP service.
54
The following code snippet is also a part of the Enroll course activity which is im-
plemented for the following function. First, it will get the list of courses which are
not enrolled courses by looping in the course array, and then later adds the new
course to the course list.
55
The manifest file contains all the necessary information about the Android appli-
cation which includes permissions used by the Android application, all the activi-
ties which will be used by the Android application. In this application there are 21
activities included in the manifest xml so that the application will function proper-
ly. The following code snippet shows how activities are included inside the An-
droid manifest.
56
8 CONCLUSION
The student enrollment application meets nearly all of the planned software re-
quirements. Yet, there is still a huge space for possible improvements in the appli-
cation even in this limited scope of functionality (compared to the main launch
application). Since the project was done by using an, own server there is undoubt-
edly an important data migration to be done when using the school right server
which is planned to do it as future work.
Students and teachers can use Student Enrollment Mobile Application with its full
functionality more frequently rather than using a computer. By pursuing the Mo-
bile Application users can easily track the course history at any time using a mo-
bile or tablet.
This application will help other mobile applications to be made in the future.
VAMK is one of the schools where several future IT professionals study. The
school does not have a single mobile application at the moment but since we are
living in Application world, VAMK will also have several apps in the near future.
There is not much sense in a relatively small application (as in the current form of
student enrollment application) because the greatest improvement could be ob-
served when transitioning between different screens (Activities). A bigger im-
proved application of this API with a lot more of activities and possible changes
should therefore be much more beneficial. Moreover, this Android application
supports many screen densities and orientations so not only can it be launched on
many devices but it also has different graphic layouts, customized for a variety of
screen resolutions and dimensions.
Android by itself is not an easy operating system for writing complex applications
if one wants to make a full use of its functionality. So far, this application has
been developed by only one developer (author of this thesis). However, the launch
application (Winha) is definitely too big of a project to be handled by such a small
group of developers.
58
REFERENCES
/5/ PHP Essentials Neil Smyth, First edition (December 19, 2010). Accessed
16.05.2014
http://freecomputerbooks.com/PHP-Essentials.html#downloadLinks