Mobile Android app to track position of bus and predict approximate arrival time

 

7.0 System Architecture,

7.1 Introduction.

The proposed system is the mobile Android platform application which allows to track position of the bus and predict approximate arrival time based on existing GPS data. The main hardware components of the project are GPS module and Wi-Fi controller to create webserver on the existing WI-FI for receiving location data (longitude, latitude).

Client side is running on java for Android. Another important element of the system is Google maps API and its different libraries to that must fit the project requirements. It provides tools for interaction with Google maps, modifying design, adding markers, getting data about locations and many other features.

The great influence on the system architecture was made by analysis of the primary research done by developer. The core features of the proposed application which have been identified as the most important are presented below:

• Estimated arrival time

According to the results, 61% of the respondents choose estimated arrival time as the most useful information in the proposed system. This function allows to

estimate distance and travel time based on a recommended route considering traffic. In this project, ETA is implemented by using the Google Maps Distance Matrix API.

• GPS tracking

GPS tracking allows to track position of a GPS module on Google map in ‘real-time’.

• Schedule

Schedule is the second function which respondents choose as the most useful information in proposed system. Application provides fast user-friendly access to the information about routes of the University buses. Users are not required to go to the website overloaded with other academic staff, advantage of mobile app is that all the information needed to be provided to users is right at their fingertips.

 

7.1 Abstract Architecture

7.1.1 System Design

7.1.1 Use-Case diagram

 

 

 

 

 

7.1.2 Use Case Specification

 

Use case name

Login

Summary

The user of the system logs into bus track application.

Dependency

(none)

Actor(-s)

User

Precondition

The user must be member of University

Main sequence

1. The system requires actor to enter username and password.

2. The actor enters his/her username and password.

3. The system validates the entered username and password, to make sure that the entered username is valid username is the system, and that the entered password is valid for entered username.

4. The actor is logged into the system, and the system shows the home page.

 

Post-condition

The user is authenticated and the system shows the home page.

 

Use case name

Schedule

Summary

The user select schedule option

Dependency

(none)

Actor(-s)

User

Precondition

The user must be logged into the system

Main sequence

1.User click on Schedule option

2.User select available Schedule

3.System displayed Schedule with time and date

 

Post-condition

Schedule page with date and time is displayed

 

 

 

Use case name

Pick the bus

Summary

The user must be logged into the system

Dependency

Include Dependencies: Display current location marker on the map , Display ETA

Actor(-s)

User

Precondition

The user must be member of University

Main sequence

1. Click ‘Pick the Buss’ button

2. Select desired destination

3. Marker and ETA are displayed on the map.

 

Post-condition

1. Marker and ETA are displayed on the map.

 

 

Use case name

Logout

Summary

The user select logout option

Dependency

(none)

Actor(-s)

User

Precondition

The user must be logged into the system

Main sequence

The user selects logout option

 

Post-condition

Return to the login page

 

 

 

Class Diagram

 

 

 

Activity diagram.

 

 

 

 

 

 

 

 

 

8.0 Project Plan.

 

The objective of a project plan is to define the major tasks, estimate timelines and resources, identify associated risks, negotiate commitments with stake holders, and provide framework for review and control with a goal to deliver the project on time. (Srinivas, 2015)

 

 

8.2

 

 

 

8.3 Test plan

 

Different types of testing methods are available for the developer to test system, which is automation testing and manual testing. The developer are using manual testing as the method to test the system because of few reasons below:

 

• Manual testing is more flexible

• Manual testing saves time and cost

• Test plan can be modified according to the project requirements.

 

In the development of the project application, two types of testing are planned to be executed. These two types of testing are unit testing and user acceptance test.

 

Mobile application is perfect to test using unit test because it validates the smallest components of the application to ensure that they are able to handle known inputs and outputs correctly. Unit tests individual classes in the application to verify they work under expected and negative cases. It helps to fastens the process of the development of application and reduces the bugs number in the feature releases.

After application is implemented, the user-acceptance testing will be next step to be performed. In other words, target users test the application for usability and performance. This type of testing allows users to test the application through their personal devices, so it helps to gather more feedback from different users with different cell phones and also make improvements on compatibility.

8.3.1 User Testing plan

 

Function

Excepted output

Actual output

Remark

Login

User can login and use functionality of the system

 

 

Click pick the bus button

Display current location of the buss on Google Map

 

 

Click sidebar

Display available functions(“Schedule”, “Logout”)

 

 

Select Schedule

Display Schedule

 

 

Logout

User returns to the login page

 

 

 

8.3.2 User-acceptance testing

 

In user-acceptance testing, end-user’s perspective to the system will be recorded. 3 new users will provide their opinions about how they see the system in terms of user-friendly and how the application flows. This is very efficient way for developer to know how users are satisfied by the system which they will be using.

 

 

 

 

 

9.0 Implementation

 

9.1 Screenshots

9.1.1 Login Page

 

 

 

 

9.1.2 Home page displays Google Map

 

 

 

 

9.1.3 Pick the bus window

 

 

 

 

 

9.1.4 Bus location marker

 

 

 

 

9.1.5 Sidebar

 

 

 

9.1.6 Schedule

 

 

 

 

 

 

 

 

 

 

 

 

 

9.2 Implementation

 

Figure 1. The Project Source Code Directiry

This is the directory where source code of the application is located in 4 different files with .java extension.

 

Figure 2. LoginActivity.java

A login screen that offers login via TP number and password – LoginActivity class. It extends AppCompatActivity class, which allows to LoginActivity class to act as the view activity in android application. ‘DUMMY_CREDENTIALS’ strings array is a dummy authentication store containing known user names and passwords. It is to be removed after connecting to a real authentication system. ‘mAuthTask’ variable is created to keep track of the login task to ensure it can be cancelled if requested. EditText and View objects are UI references. ‘onCreate’ method processes the UI when the object of the class, or simply the login menu, is opened – it sets up the login form – EditText and View, and ‘enter’ button – ‘Button mEmailSignInButton’. It is overridden from AppCompatActivity as it is a must have class, which is called when the activity is to be created. When the button is pressed the ‘onClick(View vew)’ method is called. That method calls another ‘attemptLogin()’ method, which is the next method of the LoginActivity class. The ‘attemptLogin()’ method firstly resets errors in UI fragments. Then it stores the values from those UI fragments at the time of login attempt. Then several if-else statements to check a valid password and username, and also to check for any errors. There are two supporting methods – isEmailValid() and isPassword valid, which can be replaced with a specific logic. showProgress() method shows the loading spinner, and is called from attemptLogin() method. UserloginTask internal class is to perform background logging in process, if the login was successful and the account exists the application opens up a main menu – MainActivity class.

 

 

 

Figure 3. MainActivity.java

MainActivity class also extend AppCompatActivity, and additionally implements NavigationView.OnNavigationItemSelectedListener and onMapReadyCallback interfaces, which allow the activity to implement the side bar navigation view and show the map. GoogleMap and TextView objects are UI references. ‘lat’ and ‘lon’ variables are to receive values from GPS. jsonObject is for receiving json object from directions API to get the estimated arrival times. ‘onCreate()’ method in MainActivity class also renders all the UI to the screen:

 

Figure 4. onCreate() method MainActivity class

So it shows all the UI elements such as tool bar, side menu, map, and text. It also render a floating action button, which is set to show an alert dialog, which allow to choose the busses to be shown:

 

Figure 5 FloatingActionButton MainActivity class

When the bus is chosen from the alert dialog, the ‘new Directions().execute(“”)’ and ‘new ConnectTask().execute(“”)’ are called. Those are two internal AsyncTask extended classes in the end of the MainActivity class. The ConnectTask class has the logic to create a TcpClient object, run it, and receive data from GPS. When the data is received, the class then calls onProgressUpdate() method, which processes the data received – latitude and longitude. Also, it interacts with the map and creates new markers on it such as bus itself, university buildings, and condominiums. There are custom markers on them. In the end the directions API request is sent:

 

Figure 6. Building Directions API request

The Directions class also creates a TCP client using external Volley library. Then creates a StringRequest object which allow to ask for a string response from the provided URL from the ConnectTask class. In the try-catch block the rendering of the received string is performed. It parses response as a JsonObject and fetches the latitude and longitude values:

 

Figure 7. Directions internal class. MainActivity.java

The ‘onBackPressed()’ method allows application to be run on the background by calling ‘moveTaskToBack()’ method and passing there true value. ‘onNavigationItemSelected()’ method handles navigation view item clicks – schedule view and log out. ‘onMapReady()’ method renders the map, and sets some options. ‘BitmapDescriptor()’ method allows to use custom vector images on the map view:

 

Figure 8. onBackPressed(), onNavigationItemSelected(), onMapReady(), BitmapDescriptor()

The last activity is ScheduleActivity. ScheduleActivity class extends only AppCompatActivity. It has SectionsPagerAdapter object to provide fragments for each of the sections. ViewPager object will host the section contents:

Figure 9. ScheduleActivity.java

‘onCreate()’ method again renders all UI – creates the adapter that will return a fragment for each of the four primary sections of the activity, sets up the ViewPager with the sections adapter, and creates a tab layout:

 

Figure 10. onCreate() method; ScheduleActivity class

Internal class ‘PlaceholderFragment’ extends the Fragment class and is a placeholder fragment containing a simple view. ‘ARG_SECTION_NUMBER’ is the fragment argument representing the section number for this fragment. The ‘newInstance()’ method returns a new instance of this fragment for the given section number. And ‘onCreateView()’ renders ListView and TextView UI components for each fragment in separate if-else statements:

 

Figure 11. PlaceholderFragment internal class, MainActivity class

The second internal class is SectionsPagerAdapter extends FragmentPagerAdapter class that returns a fragment corresponding to one of the four tabs:

 

Figure 12. SelectionPageAdapter internal class, MainActivity class

The last file is the TcpClient.java which has the TcpClient class which was called from MainActivity class to receive the latitude and longitude doubles. And the way it does it so is written in TcpClient class. It has server IP and server port variables with initialized values, which the application then references to when is connecting. Constructor of the class has a OnMessagedReceived parameter, it listens for the messages received from server. ‘sendMessage()’ method sends the message entered by client to the server. ‘stopClient()’ method closes the connection and release the members. ‘OnMessageReceived()’ method declares the interface. It has ‘messageReceived()’ method inside of it that must be implemented in the MainActivity class at on CoonetTask internal class doInBackground() method:

 

Figure 13. TcpClient.java

The main process happens in ‘run()’ method in try-catch block – InetAddress object is created, and server IP is passed. Them the Socket object is created with two passing parameters – server IP as InetAddress object and Server port as an integer. ‘mBufferIn’ variable is used to read messages from the server. And the data is receiving inside the while-loop. After a message is received, the process goes to ‘finally’ block where the socket is closed:

 

Figure 14. run() method; TcpClient.java

The AndroidManifest.xml file provides essential information about your app to the Android system, which the system must have before it can run any of the app’s code:

 

 

Figure 15. AndroidManifest.xml

 

Chapter 10

 

10.1

 

Function

Excepted output

Actual output

Remark

Login

User can login and use functionality of the system

User logged in and is able to use functionality of the system

Pass

Click pick the bus button

Display current location of the buss on Google Map

Current location marker of the buss on Google Map is displayed

Pass

Click sidebar

Display available functions(“Schedule”, “Logout”)

Available functions(“Schedule”, “Logout”) are displayed

Pass

Select Schedule

Display Schedule

Schedule is Displayed

Pass

Logout

User returns to the login page

User returned to the login page

Pass

 

 

10.2

 

Review on bus Tracking Application.

 

Review No 1 : Kuanysh Kerimov. Student of Asia Pacific University.

 

User interface of the application looks simple and attractive. It took a few moments to understand how to use it, which is very important for the application in my opinion. Functionality includes almost everything needed.

System sure has some things to work on. It needs webserver implementation, which is the main constrant. Extra functionality that I would add is push notifications, which could remind you if the bus you frequently use is arriving soon.

Overall, system seems to be user-friendly and effective. The idea of the project is very useful with no doubts. Even though, it has few constraints and needs improvement, I am impressed by the application taking into consideration the fact that it is a prototype.

 

Review No2: Zhandos Zhangilishbay. Student of Asia Pacific University.

 

First, I would like to mention that developing such system is a good idea. Based on my personal experience, Current Bus system need improvements as its currently has a lot of problems, which are solved by the presented system.

The application itself need further development on functional part, but the interface looks fine and easy. I really liked the application despite its constraints. If it will be developed and improved in the future, it will be a useful system.

 

10.3 Summary

Based on the results of tests above, it can be concluded that the current system development is completed as planned.

In the unit testing, the developer has tested all units by himself to ensure that all functions has expected outputs and application works stable without any bugs.

However, based on feedbacks from the user acceptance testing that was conducted with 3 users, there are positive feedbacks as well as negative. It shows that the system has some weaknesses and limitations. Users like simple and friendly interface, they support the main idea of the project. Testers also suggest to add some interesting functions in future to make application more useful and more attractive. Any future enhancements and limitations will be discussed in the next chapter.

 

10.1 Critical Evaluation

 

A critical evaluation report to eva

 

Developer gained the giant amount of knowledge throughout the development of this project. Knowledge from different filed such as requirements gathering, system architecture, development, deployment, quality assurance and a lot more was experienced in order to complete this project successfully. All these knowledges can be divided on two categories technical and non-technical.

 

 

 

 

 

Provide server side of the application.

 

According to the limitation of the application which are stated above, the application is not

 

Leave a Comment

Time limit is exhausted. Please reload the CAPTCHA.