You are on page 1of 59

Rise Krishna Sai Prakasam Group of Institutions

CHAPTER 1
INTRODUCTION

B. Tech Computer Science and EngineeringPage 1


Rise Krishna Sai Prakasam Group of Institutions

1.INTRODUCTION

New applications as people expecting new technologies and applications in the


mobiles. In the entire world of technology, mobiles are playing a major role in almost every
corner. As new models of mobiles are coming in day-by-day, the technology and applications
are also increasing. Android is an open source for developing.
Nowadays, buses are used rapidly as a transportation system in the different Organization,
e.g., school, college, university, banks etc. but, with the increase of Vehicles day by day which
further leading to heavy traffic which results in more delay at the destination of the respective
buses this reason at the bus station most of the time people have to wait for the arrival of buses
therefore, an effective transportation system has effective movement of vehicle and people
which leads to better quality of life. Hence, the bus tracking system can be useful for
passengers which will provide the location of the buses with roots using Google map at the
current time.
Today Smartphone’s are a very good source for tracking the vehicles, because of
giving the real-time location of the bus with the help of global positioning system (GPS). GPS
uses satellite to locate the presence of Smartphone’s using the values of latitude and longitude
using those values of GPS coordinates our developed application will show the location of the
Smartphone’s used in each bus carried by the driver. User uses can retrieve information
relevant to the arrival time of the bus.

About Android
Android, the World's Most Popular Mobile Platform:
Android powers hundreds of millions of mobile devices in more than 190 countries around
the world. It's the largest installed base of any mobile platform and growing fast—every
day another 900,000 user’s power up their Android devices for the first time and start
looking for apps, games, and other digital content.
Android gives you a world-class platform for creating apps and games for Android users
everywhere, as well as an open marketplace for distributing to them instantly.
Generally, Android is a software stack for mobile devices that includes an operating
system, middleware and key applications.
Android is based on JAVA and all its applications are developed in JAVA. Uses Linux
to provide core system services
Security.

B. Tech Computer Science and EngineeringPage 2


Rise Krishna Sai Prakasam Group of Institutions
Memory .
Hardware drivers.
1.1Android Features:
Application framework enabling reuse and replacement of components.
Optimized Java virtual machine: Dalvik (about this DVM we learn in
coming classes) .
Optimized Graphics Processing, supporting 2D and 3D graphics (OpenGL
ES 1.0 ) .
Integrated open source web browser: Web
Kit. SQLite for structured data storage.
Multimedia capability, supporting varieties of audio, video and still image
formats.
GSM Telephony.
Bluetooth, EDGE, 3G and Wi-Fi support.
Camera, GPS, compass, accelerometer and other sensors support.
Rich development environment, including an emulator, debugging tools,
memory probe tools, log tools and powerful eclipse plugins.

History of Android:

Android, Inc. was founded in Palo Alto California, United States in October, 2003 by
Andy Rubin (co-founder of Danger), Rich Miner and Chris White.
Google acquired Android Inc. on August 17, 2005, making Android Inc. a wholly owned
subsidiary of Google Inc With same Android, Inc Team.
Google was planning to enter the mobile phone market with this move.
In 2007 announced Open Handset Alliance with several companies which
include Broadcom Corporation, Google, HTC, Intel, LG, Marvell Technology
Group, Motorola, Nvidia, Qualcomm, Samsung Electronics, Sprint Nextel, T-
Mobile and Texas Instruments .
Android Open Source Project (AOSP):
"The goal of the Android Open Source Project is to create a successful real-
world product that improves the mobile experience for end users.
And one that can run any application written by third-party developers using
the Android SDK.

Version history
2008: Google sponsors 1st Android Developer Challenge T-Mobile G1 announced,
SDK 1.0 released as a open source that is Android dev phone 1.
2009: New soft keyboard with “auto complete” feature. That is SDK 1.5 called by
name Cupcake. In the same year SDK 1.6 with Support Wide VGA called by

B. Tech Computer Science and EngineeringPage 3


Rise Krishna Sai Prakasam Group of Institutions
name Donut and JDK 2.0/2.0.1/2.1 with beautiful UI and Browser by name called
Éclair.
2010: SDK 2.2 with Flash support called Froyo and the version we are using that is SDK
2.3 called Gingerbread with UI update, system-wide copy-paste.
2011: SDK 3.0 (Honeycomb) for tablets only.
2012: SDK 4.0 "Ice Cream Sandwich" for smart phones and tablets.

Android Apps:
Built using Java and new SDK libraries

 No support for some Java libraries like Swing


& AWT

 Oracle currently suing Google over use

 Java code compiled into Dalvik byte code (.dex)

 Optimized for mobile devices (better memory management,


battery utilization, etc.)

 Dalvik VM runs .dex files

1.2 Android Architecture:

B. Tech Computer Science and EngineeringPage 4


Rise Krishna Sai Prakasam Group of Institutions

Fig 1.2: Android Architecture

Libraries:

Android includes a set of C/C++ libraries used by various components of the


Android system. These capabilities are exposed to developers through the Android
application framework. Some of the core libraries are listed below:

System C library - a BSD-derived implementation of the standard C system library (libc),


tuned for embedded Linux-based devices
Media Libraries - based on Packet Video's Open CORE; the librariessupport playback
and recording of many popular audio and video formats, as well as static image files, including
MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG
Surface Manager - manages access to the display subsystem and
seamlessly composites 2D and 3D graphic layers from multiple
applications
Lib Web Core - a modern web browser engine which powers both the
Android browser and an embeddable web view
SGL - the underlying 2D graphics engine
3D libraries - an implementation based on OpenGL ES 1.0 APIs; the
libraries use either hardware 3D acceleration (where available) or the
included, highly optimized 3D software rasterizer
Free Type - bitmap and vector font rendering
SQLite - a powerful and lightweight relational database engine available to
all applications.

1.3 ANDROID TECHNOLOGY


Android is a software stack for mobile devices that includes an operating system,
middleware and key applications. Google Inc. purchased the initial developer of the
software, Android Inc., in 2005. Android's mobile operating system is based on the Linux
kernel. Google and other members of the Open Handset Alliance collaborated on Android's
development and release. The Android Open Source Project (AOSP) is tasked with the
maintenance and further development of Android. The Android operating system is the
world's best-selling Smartphone platform. The Android SDK provides the tools and APIs
to the necessary to begin developing applications Android platform using the Java
programming language. Android has a large community of developers writing applications
("apps") that extend the functionality of the devices. There are currently over 250,000 apps
available for Android.

B. Tech Computer Science and EngineeringPage 5


Rise Krishna Sai Prakasam Group of Institutions

Fig 1.3 Android Versions and Features


Features
Application framework enabling reuse and replacement of components.

Android Runtime Management optimized for mobile device integrated


browser based on the open source Web Kit engine.
Optimized graphics powered by a custom 2D graphics library; 3D
graphics based on the OpenGL ES 1.0 specification (hardware acceleration
optional)
1.4 Android Runtime:

Android includes a set of core libraries that provides most of the functionality
available in the core libraries of the Java programming language. Every Android
application runs in its own process, with its own instance of the Dalvik virtual machine.
Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM
executes files in the Dalvik Executable (.dex) format which is optimized for minimal
memory footprint. The VM is register-based, and runs classes compiled by a Java language
compiler that have been transformed into the. dex format by the included "dx" tool.

The Dalvik VM relies on the Linux kernel for underlying functionality such as threading
and low-level memory management.

B. Tech Computer Science and EngineeringPage 6


Rise Krishna Sai Prakasam Group of Institutions

1.5 Android Operating System:


Android is an operating system based on Linux with a Java programming
interface. It provides tools, e.g. a compiler, debugger and a device emulator as well as
its own Java Virtual machine (Dalvik Virtual Machine - DVM). Android is created by
the Open Handset Alliance which is led by Google.

Android uses a special virtual machine, e.g. the Dalvik Virtual Machine. Dalvik uses
special byte code. Therefore, you cannot run standard Java byte code on Android.
Android provides a tool "dx" which allows converting Java Class files into "dex"
(Dalvik Executable) files. Android applications are packed into an .apk (Android
Package) file by the program "aapt" (Android Asset Packaging Tool) To simplify
development Google provides the Android Development Tools (ADT) for Eclipse. The
ADT performs automatically the conversion from class to dex files and creates the apk
during deployment.

Android supports 2-D and 3-D graphics using the OpenGL libraries and supports data
storage in a SQLite database. Every Android applications runs in its own process and
under its own user id which is generated automatically by the Android system during
deployment. Therefore the application is isolated from other running applications and a
misbehaving application cannot easily harm other Android applications.

1.6. Important Android components:

An Android application consists out of the following parts:

Activity - Represents the presentation layer of an Android application,


e.g. a screen which the user sees. An Android application can have
several activities and it can be switched between them during runtime of
the application.
Views - The User interface of Activities is built with widgets classes
which inherent from "android. View. View". The layout of the views is
managed by "android. View. View Groups".

Services - perform background tasks without providing an UI. They can


notify the user via the notification framework in Android.
Content Provider - provides data to applications, via a content provider
your application can share data with other applications. Android
contains a SQLite DB which can serve as data provider
Intents are asynchronous messages which allow the application to
request functionality from other services or activities. An application
can call directly a service or activity (explicit intent) or asked the
Android system for registered services and applications for intent
(implicit intents). For example, the application could ask via intent for a
contact application. Application register them self to an intent via an
Intent Filter. Intents are a powerful concept as they allow creating
loosely coupled applications.
Broadcast Receiver - receives system messages and implicit intents, can

B. Tech Computer Science and EngineeringPage 7


Rise Krishna Sai Prakasam Group of Institutions

be used to react to changed conditions in the system. An application can


register as a broadcast receiver for certain events and can be started if
such an event occurs.
A Java Virtual Machine (JVM) enables a set of computer software
programs and data structures to use a virtual machine model for the
execution of other computer programs and scripts. The model used by a
JVM accepts a form of computer intermediate language commonly
referred to as Java byte code. This language conceptually represents the
instruction set of a stack-oriented, capability architecture. Sun
Microsystems states there are over 4.5 billion JVM-enabled devices
A JVM can also execute byte code compiled from programming
languages other than Java. For example, Ada source code can be
compiled to execute on a JVM. JVMs can also be released by other
companies besides Oracle (the developer of Java) — JVMs using the
"Java" trademark may be developed by other companies as long as they
adhere to the JVM specification published by Oracle and to related
contractual obligations.
Java was conceived with the concept of WORA: "write once, run
anywhere". This is done using the Java Virtual Machine. The JVM is
the environment inwhich java programs execute. It is software that is
implemented on non- virtual hardware and on standard operating
systems.

Hardware developers

Programmers App developers


Phone users

Application Components:
Activity
◦ An activity represents a single screen with a user interface. An
activity is implemented as a subclass of Activity .

◦ A service is a component that runs in the background to perform


long- running operations or to perform work for remote
processes. A service does not provide a user interface.
◦ Example: For example, a service might play music in the
background while the user is in a different application

Broadcast Receivers

B. Tech Computer Science and EngineeringPage 8


Rise Krishna Sai Prakasam Group of Institutions

◦ A broadcast receiver is a component that responds to system-


wide broadcast announcements.
◦ Example: a broadcast announcing that the screen has turned off,
the battery is low, or a picture was captured.

 Content Providers
◦ Store and retrieve data and make it accessible to all applications.

◦ Example: Android ships with a number of content providers for


common Types (e.g., audio, video, images, personal contact
information, etc.)

What is SQLite?
SQLite is an Open Source Database which is embedded into Android.
SQLite supports standard relational database features like SQL syntax,
transactions and prepared statements. In addition, it requires only little
memory at runtime (approx. 250 Kbytes).

SQLite supports the data types TEXT (similar to String in Java),


INTEGER (similar to long in Java) and REAL (similar to double in
Java). All other types must be converted into one of these fields before
saving them in the database.
Note: By default, SQLite on Android does not have a management
interface or an application to create and manage databases from, so
we're going to create the database ourselves by code.
SQLite is available on every Android device. Using an SQLite database
in Android does not require any database setup or administration.
You only have to define the SQL statements for creating and updating
the database. Afterwards the database is automatically managed for you
by the Android platform.
First, we will create a class that handles all the operations required to
deal with the database such as creating the database, creating tables,
inserting and deleting records and so on.
Main classes to create SQLite database: -
1) SQLiteOpenHelper:
To create and upgrade a database in your Android application we
usually subclass SQLite Open Helper.
2) SQLite Database:

SQLite Database is the base class for working with a SQLite database in
Android and provides methods to open, query, update and close the database.

Technical Background:
Android Services

B. Tech Computer Science and EngineeringPage 9


Rise Krishna Sai Prakasam Group of Institutions

Service
A Service is a component which runs in the background, without interacting with the
user. Every developer can create new Services in his application Services support
true multitasking for Android, as they can run in their own process. If you use
threads in Activities there are still connected to the life-cycle of Activities and the
Android system may decide to terminate them at any point in point.

Android Platform Service


The Android platform provides pre-defined Services, usually exposed via a specific
Manager class. Access to these services can be gained via the
method getSystemService ()

B. Tech Computer Science and EngineeringPage 10


Rise Krishna Sai Prakasam Group of Institutions

CHAPTER 2
LITERATURE SURVEY

B. Tech Computer Science and EngineeringPage 11


Rise Krishna Sai Prakasam Group of Institutions

2.LITERATURE SURVEY

2.1 Purpose:
A literature survey or literature review is the study of references projects and old
algorithms that we have read for designing the proposed methods. It also helps in
reporting summarization of all the old references projects, and their drawbacks. The
detailed literature survey for the project helps in comparing and contrasting various
methods, algorithms in various ways that have implemented in the research.

Related Study:
Eddie Chi-Wah Lau, ‘‘Simple Bus Tracking System’’, Journal of Advanced Computer
Science and Technology Research, vol.3, no.1, 2013.
This paper presents the bus tracking application using smart phones. The application
consists of both the transmitter and receiver inbuilt in mobile phones. The transmitter is
used to transmit the location and vehicle status information to the server. The receiver is
the user who can view the details regarding the bus location using his smart phone via
Google map. Due to the movement of bus is always available this project can also
ensure security by keeping track of the bus. So in the coming year it is going to play a
major role in our day to day living.

“ Android Application For Bus Tracking System” By Neethu Mittal, KaranSnotra,


Amity University Uttar Pradesh, Noida.

CONCLUSION FROM LITERATURE SURVEY:

 The purpose of this research is to find a way to implement a system that will provide a
solution not only for Buses The application will prove benificial for every bus traveler,
or even tourists. Not just buses, but this application will be useful for every person
travelling by any means of transport.
 The main aim of this Android application is to track the buses which would give the
exact location of buses with the help of Google map and help the users to plan their way
to reach their destination on time. This application may be greatly used by public since
Android mobiles has become common and spread everywhere. In addition, this will also
enhance the security since the movement of the buses is always available.

B. Tech Computer Science and EngineeringPage 12


Rise Krishna Sai Prakasam Group of Institutions

CHAPTER 3
SYSTEM ANALYSIS

B. Tech Computer Science and EngineeringPage 13


Rise Krishna Sai Prakasam Group of Institutions

3. SYSTEM ANALYSIS
3.1Problem Definition:
This application is designed in the entire world of technology, mobiles are playing a major
role in almost every corner. As new models of mobiles are coming in day-by-day, the
technology and applications are also increasing. Android is an open source for developing
new applications as people expecting new technologies and applications in the mobiles.
This application is designed for a random user who are not willing to getting late or miss
the bus. By using this application users can easily reach their destination within the time.
This application includes the location of driver and students by using the global
positioning system(GPS).this application mainly consists of driver, student and database.
In this application the driver and student must have the android mobiles. The student and
driver need to register to run the application. Then the student and driver login in the
application and the student add the location. The student location should be stored in
database then it will be send to the driver. when the driver reaches to the destination the
student get the alert signals ( the bus is arriving). The location should be updated
automatically.
3.2 Existing system:

The existing system has the some of the drawbacks like


 The exact position of the vehicle is cannot be retrieved.
 This application mainly used for public.
 The bus location cannot be retrieved from anywhere.
 The movement of the bus is also not visible in google map.

3.3 Proposed System:

 The proposed system provides the user can get the alerts from the bus.
 The users can select the bus number which they want to travel.
 The position of the bus is displayed in the google map.
 This also enhances security because the movement of the bus is always
available.
 Every one can track the bus at anytime and anywhere.
 The bus location can be retrieved from anywhere.

B. Tech Computer Science and EngineeringPage 14


Rise Krishna Sai Prakasam Group of Institutions

3.4 Feasibility Study:

Feasibility study is an important phase in the software development process


.It enables the developer to have an assessment of the
product being developed. It refers to the feasibility study of the product in
terms of outcomes of the product, operational use and technical support
required for implementing it.
Feasibility study should be performed on the basis of various criteria
and parameters.
The various feasibility studies are:
Operational feasibility
Technical feasibility
Economic feasibility
3.4.1 Operational Feasibility:

The aspect of study is to check the level of acceptance of the system by


the user. This includes the process of training the user to use the system
efficiently. The user must not feel threatened by the system, instead must
accept it as a necessity. The level of acceptance by the users solely depends on
the methods that are employed to educate the user about the system and to
make him familiar with it. His level of confidence must be raised so that he is
also able to make some constructive criticism, which is welcomed, as he is the
final user of the system.

3.4.2 Technical Feasibility:

This study is carried out to check the technical feasibility, that is, the
technical requirements of the system. Any system developed must not have a
high demand on the available technical resources. This will lead to high
demands on the available technical resources. This will lead to high demands
being placed on the client. The developed system must have a modest
requirement, as only minimal or null changes are required for implementing
this system.

3.4.3 Economic Feasibility:

This study is carried out to check the economic impact that the system

B. Tech Computer Science and EngineeringPage 15


Rise Krishna Sai Prakasam Group of Institutions
will have on the organization. The amount of fund that the company can pour
into the research and development of the system is limited.

The expenditures must be justified. Thus the developed system as well within
the budget and this was achieved because most of the technologies used are
freely available. Only the customized products had to be purchased.

As defined in requirements engineering, functional requirements specify


particular results of a system. This should be contrasted with non-functional
requirements which specify overall characteristics such as cost and reliability.
Functional requirements drive the application architecture of a system, while
non- functional requirements drive the technical architecture of a system.

This section of the requirements document provides use cases on the


functional aspects for the portable media player as requested by the
participants of the study in the previous section. The following controls will be
on the device player: power on/off, menu, play, pause, rewind, fast forward,
repeat, lock, scroll and select feat
3.5 SYSTEM SPECIFICATION:

3.5.1 HARDWARE REQUIREMENTS:


Processor : i3
Hard Disk : 500GB.
Memory : 4GB RAM
Mobile : Android
Phone

3.5.2 SOFTWARE REQUIREMENTS:

Coding Language : Java


IDE : Android Studio
Operating System : Window7,8,10

B. Tech Computer Science and EngineeringPage 16


Rise Krishna Sai Prakasam Group of Institutions

CHAPTER 4
SYSTEM DESIGN

B. Tech Computer Science and EngineeringPage 17


Rise Krishna Sai Prakasam Group of Institutions

4. SYSTEM DESIGN
4.1 Unified Modelling Language:
The UML’s four structural diagram exists to visualize, specify, construct and document the
static aspects of system. Just as the static aspects of a house encompass the existence and
placement of such things as walls, doors, windows, pipes, wires and vents. So, to do the
static aspects of a software system encompass the existence and placement of such things
classes, interfaces, collaborations, components and nodes.

Relations:

1.Dependency:

Dependency is a semantic relationship between two things in which change to one


thing may affect the semantics of other things. Graphically a dependency rendered
as a dashed-line, possibly directed occasionally including a label.

Fig: Dependency

2.Association:

 Association is a structural relationship that describes set of links. The link


being as a connection among objects. Aggregation is a special kind of
association a structural relationship between a whole and its parts.
 It is graphically rendered as a solid-line. Such as multiplicity and role name.

Employer employee

Fig: Association

B. Tech Computer Science and EngineeringPage 18


Rise Krishna Sai Prakasam Group of Institutions

3. Generalization
Generalization is a specialization/generalization relationship in which objects of
specialized element (child) are substitutable for object of the
Generalized element (parent).in this way the child shares the structure and
behaviour of the parent.
 Graphically, rendered as a solid-line with a hollow over-head
pointing to the parent.

Fig: Generalization

4.Realization:

A realization is a semantic relationship between classifiers. Where in one classifier


specifies a contract that another classifier guarantees to carry-out you will
encounter relationships in two places between interfaces and classes or components
between use case collaborations.
Graphically, rendered as cross between generalization and
dependency relationships.

Fig: Realization

B. Tech Computer Science and EngineeringPage 19


Rise Krishna Sai Prakasam Group of Institutions

4.1.1 System Architecture

Fig4.1.1 System Architecture

B. Tech Computer Science and EngineeringPage 20


Rise Krishna Sai Prakasam Group of Institutions

4.2 UML Diagrams:

The (UML) is a general and all-purpose modelling and planning language in the Software
engineering field, which provides a standard way to envisage or visualize the design of a
system in a pictorial format. Unified modelling language is a language for writing blueprints.
Specifying-building models that is precise, unambiguous, and
complete. Constructing-directly connected to various programming
languages.
Visualizing-modelling textually as well as graphically.

4.2.1 Use case Diagram:

A use case diagram shows as set of use cases and actors and their relationships. Use case
diagrams are especially important in organizing and modeling behavior of a system.

Fig 4.2.1: use case diagram

B. Tech Computer Science and EngineeringPage 21


Rise Krishna Sai Prakasam Group of Institutions

4.2.2 Class Diagram:

A class diagram is a set of various related objects that share the same characteristics
called attributes operations called activities, relationships called associations and semantics
called rules. A class is a whole set of objects. Its representation is

Class Name

Attributes

Operations

B. Tech Computer Science and EngineeringPage 22


Rise Krishna Sai Prakasam Group of Institutions

Objects of the Class


The purpose of class diagram is to model the static view of an application.
Class diagrams are the only diagrams which can be directly mapped with
object- oriented languages and thus widely used at the time of construction.
UML diagrams like activity diagram, sequence diagram can only give the
sequence flow of the application; however class diagram is a bit different. It is
the most popular UML diagram in the coder community.
The purpose of the class diagram can be summarized as −
Analysis and design of the static view of an application.
Describe responsibilities of a system.
Base for component and deployment
diagrams. Forward and reverse engineering.

Fig 4.2.2 Class Diagram


4.2.3 Sequence Diagram:
It is an interaction diagram that emphasizes the time ordering of messages. A sequence
diagram shows objects participating in the interaction by their lifetime and the messages that

B. Tech Computer Science and EngineeringPage 23


Rise Krishna Sai Prakasam Group of Institutions
they exchange/arranged in the time sequence.
Description:
It contains
Object: It is represented as horizontal rectangle.
Object Lifeline: It represents the existence of an object at a particular instance of
time and is represented as
Focus of control: It is a tall, thin rectangle that shows the period of time during
which an object is performing an action.
Messages: It is communication between objects, shown as horizontal solid arrow
from one object to another object.
In the below diagram

B. Tech Computer Science and EngineeringPage 24


Rise Krishna Sai Prakasam Group of Institutions

Fig 4.2.3: Sequence Diagram

4.2.4 Activity Diagram


Activity Diagram in some ways is like a flowchart with states. With the activity
diagram you can observe waft of activities to your machine inside the order that they take
place. Note the activity diagram looks as if a move among a kingdom diagram, a use case
diagram and a flowchart. Activities appearance much like states however they may be a chunk
more rounded. They are stateless in that they take place and automatically transition to the
following country upon completing. The diamond is a conditional branch that determines
which pastime to transition too primarily based on a situation and it is also stateless. Activity
Diagram consists of

B. Tech Computer Science and EngineeringPage 25


Rise Krishna Sai Prakasam Group of Institutions

Action states.
Transition.
Objects.
Contains Fork, Join and branching relations along with flow Chart symbols.
REPRESENTATION OF ACTIVITY DIAGRAM
Action State is represented as a shape with straight top and bottom and with
convex areas on the two sides.

Diamond shape symbol represents branching. It specifies alternate paths and


decision satisfying the constraint. Transition represent Flow of control between
Start state and end state.

B. Tech Computer Science and EngineeringPage 26


Rise Krishna Sai Prakasam Group of Institutions

Fig 4.2.4 Activity Diagram

4.2.5 Statechart Diagram


A State Chart diagram shows the state machine focusing on the flow of control from
state to state. In the UML these are used to model the behavioural aspects of a system. A state
chart diagram comprises states and events.
A state is defined as the situation in the life of an object. An event can trigger a state
transition. The relationship between the states can be represented by a transition. Objects have
behavior and state. The state of an object depends on its current activity or condition. A state
chart diagram shows the possible states of the object and the transitions that cause a change in
state.
A state chart diagram can have the similar properties of another diagram.
It has an initial and final states, action states, objects, forks, joins etc…

B. Tech Computer Science and EngineeringPage 27


Rise Krishna Sai Prakasam Group of Institutions

USES OF STATE CHART DIAGRAM


It is used to model the dynamic aspects of a system.

State diagrams are also used to describe the behaviour of a Single class objects.

Fig 4.2.5 State chart Diagram

B. Tech Computer Science and EngineeringPage 28


Rise Krishna Sai Prakasam Group of Institutions

CHAPTER5
SYSTEM
IMPLEMENTATION

B. Tech Computer Science and Engineering Page 29


Rise Krishna Sai Prakasam Group of Institutions

5. SYSTEM IMPLEMENTATION
5.1 Modules:
1. Driver
2. User
3. GPS
4. Geo Fencing
5. SMS Service
6. Database

5.1.1 Driver:
 The driver must register first to run application.

 The driver can link the bus and after that starts his bus.
 The driver can add the stages and mobile numbers in

 Google maps for the purpose of getting alerts to the users.

5.1.2 User:
 User must register in order to login into the application.

 After logging he/she they can link the bus number and get the location of the
bus.
 The user can see the stages in the Google maps so that the user can understand
where the bus will stopped.

5.1.3 GPS:
 To display our bus in Google Maps we need Gps.
 Gps is a location based service get signals from Gps satellite.

5.1.4 GeoFencing:-
 A geofencing is a virtual perimeter for a real-world geographic area.
 Based on that geographical area when the driver touch the circle then the user

B. Tech Computer Science and Engineering Page 30


Rise Krishna Sai Prakasam Group of Institutions
can get alert from the driver.
5.1.5 SMS Service:
 In order to receive the alerts we need SMS service.
 By using SMS service the user can get alert from the driver.
 The user can get alert when the bus is nearly 1km.
 Whenever the bus touches the geofence circle the user can get alert from the driver.

5.1.6 Database:
 All the available information will be stored in the database like student, driver, stages,
phone no…etc.
 The database can update the location every moment of time.
 The admin can modify/view the data in the database.

B. Tech Computer Science and Engineering Page 31


Rise Krishna Sai Prakasam Group of Institutions

5.2 CODING:
package com.example.aditya.bustrack;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;

import android.text.Layout;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.Toast;

import android.graphics.drawable.AnimationDrawable;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.coordinatorlayout.widget.CoordinatorLayout;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;

import butterknife.BindView;
import butterknife.ButterKnife;

public class LoginActivity extends AppCompatActivity {


private CoordinatorLayout coordinatorLayout;
private AnimationDrawable animationDrawable;

B. Tech Computer Science and Engineering Page 32


Rise Krishna Sai Prakasam Group of Institutions

@BindView(R.id.text_input_layout_email)
TextInputLayout emailWrapper;
@BindView(R.id.text_input_layout_password)
TextInputLayout passwordWrapper;
@BindView(R.id.btnLogin)
Button login;

@BindView(R.id.registerbtn)
Button registerbtn;
@BindView(R.id.chooser_spinner)
Spinner userType;

private TextInputEditText emailInput;


private TextInputEditText passwordInput;
public static final String LOG_TAG = LoginActivity.class.getSimpleName();
private int bus_num = 0;
//Firebase utils
private FirebaseAuth mAuth;
private FirebaseAuth.AuthStateListener mAuthStateListener;
private ProgressDialog mProgress;

@Override
protected void onStop() {
super.onStop();
mAuth.removeAuthStateListener(mAuthStateListener);
}

@Override
protected void onStart() {
super.onStart();
mAuth.addAuthStateListener(mAuthStateListener);
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
ButterKnife.bind(this);

ConnectivityManager cm = (ConnectivityManager)
getSystemService(this.CONNECTIVITY_SERVICE);
NetworkInfo nInfo = cm.getActiveNetworkInfo();
if(nInfo != null && nInfo.isConnected()){

}
else {

B. Tech Computer Science and Engineering Page 33


Rise Krishna Sai Prakasam Group of Institutions

AlertDialog.Builder a_builder = new AlertDialog.Builder(LoginActivity.this) ;


a_builder.setMessage("Please enable internet connection !!!")
.setCancelable(false)
.setPositiveButton("Settings", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {

Intent in = new
Intent(android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS );
startActivity(in);

}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.cancel();
}
});
AlertDialog alert = a_builder.create();
alert.setTitle("No Internet Connection");
alert.show();
}

/*
// init coordinatorLayout
coordinatorLayout = (CoordinatorLayout) findViewById(R.id.activity_login);
// initializing animation drawable by getting background from constraint layout
animationDrawable = (AnimationDrawable) coordinatorLayout.getBackground();

// setting enter fade animation duration to 5 seconds


animationDrawable.setEnterFadeDuration(5000);

// setting exit fade animation duration to 2 seconds


animationDrawable.setExitFadeDuration(2000);
*/
mProgress = new ProgressDialog(LoginActivity.this, R.style.AppTheme_Dark_Dialog);
mProgress.setMessage("Authenticating...");
mProgress.setCancelable(true);
mProgress.setIndeterminate(true);

// overridePendingTransition(R.anim.slide_in_right, R.anim.stay_in_place);

mAuth = FirebaseAuth.getInstance();

B. Tech Computer Science and Engineering Page 34


Rise Krishna Sai Prakasam Group of Institutions

mAuthStateListener = new FirebaseAuth.AuthStateListener() {


@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null) {
Boolean ut =
getPreferences(Context.MODE_PRIVATE).getBoolean(getString(R.string.isDriver), false);
Log.d("UT",ut.toString());
if (ut) {
Intent intent = new Intent(LoginActivity.this, DriverMapsActivity.class);
startActivity(intent);
finish();
} else {
Intent intent = new Intent(LoginActivity.this, StudentMapsActivity.class);
startActivity(intent);
finish();
}
}
}

};

// switchToSignUp.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// Intent intent = new Intent(LoginActivity.this, SignUPActivity.class);
// startActivity(intent);
// }
// });

login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mProgress.show();
hideKeyBoard();
emailInput = (TextInputEditText) emailWrapper.getEditText();
passwordInput = (TextInputEditText) passwordWrapper.getEditText();
String email = emailInput.getText().toString();
String password = passwordInput.getText().toString();

/**
* Saving detail of the user in a shared preference file i.e he is driver or not
* and will check from that shared pref while logging in!
*/

B. Tech Computer Science and Engineering Page 35


Rise Krishna Sai Prakasam Group of Institutions

if (userType.getSelectedItem().toString().equals("Driver")) {
SharedPreferences.Editor editor = getPreferences(Context.MODE_PRIVATE).edit();
editor.putBoolean(getString(R.string.isDriver), true);
editor.commit();
}else{
SharedPreferences.Editor editor = getPreferences(Context.MODE_PRIVATE).edit();
editor.remove(getString(R.string.isDriver));
editor.commit();
}

mAuth.signInWithEmailAndPassword(email,
password).addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (!task.isSuccessful()){
Toast.makeText(LoginActivity.this ,"Sign in error!"
,Toast.LENGTH_SHORT).show();
mProgress.dismiss();
}

}
});
}
});

registerbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mProgress.show();
hideKeyBoard();
emailInput = (TextInputEditText) emailWrapper.getEditText();
passwordInput = (TextInputEditText) passwordWrapper.getEditText();
String email = emailInput.getText().toString();
String password = passwordInput.getText().toString();
String user = userType.getSelectedItem().toString();

if (user.equals("Driver")) {
SharedPreferences.Editor editor = getPreferences(Context.MODE_PRIVATE).edit();
editor.putBoolean(getString(R.string.isDriver), true);
editor.commit();
} else

B. Tech Computer Science and Engineering Page 36


Rise Krishna Sai Prakasam Group of Institutions
{

SharedPreferences.Editor editor = getPreferences(Context.MODE_PRIVATE).edit();


editor.remove(getString(R.string.isDriver));
editor.commit();
}

mAuth.createUserWithEmailAndPassword(email,
password).addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (!task.isSuccessful()) {

Toast.makeText(LoginActivity.this, "Sign up error!",


Toast.LENGTH_SHORT).show();
} else {
String user_id = mAuth.getCurrentUser().getUid();

Log.i(LOG_TAG, "User is : " + user);


Boolean isDriver =
getPreferences(Context.MODE_PRIVATE).getBoolean(getString(R.string.isDriver), false);
if (isDriver) {
DatabaseReference user_db =
FirebaseDatabase.getInstance().getReference().child("Users").child("Driver").child(user_id);
user_db.setValue(true);
} else {
DatabaseReference user_db =
FirebaseDatabase.getInstance().getReference().child("Users").child("Students").child(user_id);
user_db.setValue(true);
}
}
}
});
}
});
}
@Override
public void finish() {
super.finish();
//LoginActivity.this.overridePendingTransition(0, R.anim.slide_out_right);
}
private void hideKeyBoard() {
View view = this.getCurrentFocus();
if (view != null) {
InputMethodManager manager = (InputMethodManager)

B. Tech Computer Science and Engineering Page 37


Rise Krishna Sai Prakasam Group of Institutions

getSystemService(Context.INPUT_METHOD_SERVICE);
view.clearFocus();
manager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
@Override
protected void onResume() {
super.onResume();
if (animationDrawable != null && !animationDrawable.isRunning()) {
// start the animation
animationDrawable.start();
}
}

@Override
protected void onPause() {
super.onPause();
if (animationDrawable != null && animationDrawable.isRunning()) {
// stop the animation
animationDrawable.stop();
}
}
}

B. Tech Computer Science and Engineering Page 38


Rise Krishna Sai Prakasam Group of Institutions

CHAPTER 6
SYSTEM TESTING

B. Tech Computer Science and Engineering Page 39


Rise Krishna Sai Prakasam Group of Institutions

6. SYSTEM TESTING
6.1 Purpose of Testing:
Software Testing Strategy integrates the software test cases into a series of well-
planned steps and series of planned procedures that result in the successful construction,
Design and Implementation of a software. Various Software testing Methods are referred for
Verification and Validation. Software Verification refers to the set of activities on the
designed functions and programs for ensuring that the software or the product correctly
implements a specific function or the required output. Software Validation refers to a set of
activities that ensure that the software or product or application that has been built for
traceable to customer’s requirements and providing the customer to input valid data and make
Data store free from redundancy.
6.2 Testing Strategies:
6.2.1 Unit Testing
In software testing, Unit testing mainly focuses on verification effort on the smallest
unit of program or software design that is also called a module. In unit testing the procedural
or functional design provides a detailed description as a guide, focal the control paths are
tested to uncover errors occurred in the designed software within the boundaries of the
module. The unit testing of software is normally white box or open testing oriented and the
series of steps can be conducted in corresponding or parallel for multiple modules or
functions.
6.2.2 Integration Testing
Integration testing is another Testing for systematic technique and product module
integrating which constructs the program structure and makes the data flow between the
modules, while conducting Integration Testing it requires to uncover errors associated with
various interfaces. The main objective is to take unit tested methods and activities to build a
program structure that have been dictated by design.
6.2.3 Validation Testing
The Validation Testing is integration testing for software which is completely
assembled as a package. The Validation testing is the next stage in Testing Activities, which
can be defined as successful testing process for the software functions in the manner
reasonably expected by the customer.

B. Tech Computer Science and Engineering Page 40


Rise Krishna Sai Prakasam Group of Institutions

6.2.4 System Testing


To check system activities related to computer we process system testing which is
actually a series of different tests whose primary purpose is to test the functionalities of
computer-based system. Even though each test has a different purpose of checking the
validations and integrations of product, all work is to verify that all system elements and
system activities which have been properly integrated to perform allocated functions.
6.2.5 White Box Testing
White Box Testing is also called as Open or Glass box testing. In White Box Testing,
by finding the specified program or function that a software product or a software program
has been designed or developed to perform or execute the test can be implemented and
conducted for the demonstrates each program or function in a fully operated at the same time
finding for errors in each program. It is a glass box or open test case design method that uses
the wide control on structure of the procedural program and design to find and drive the test
cases. The starting path testing activities is a white box testing.
6.2.6 Black Box Testing
In Black Box testing by understanding and knowing the various program internal
operation of an application or product or program, Black Box Testing can be conducted to
guarantee that all gears mesh of the internal activities of the product or program or application
can be tested. The process provides a internal operation to check the performance and
specifications of all the internal mechanism which have been passably exercised. Black Box
Testing fundamentally focuses on the functional activities and requirements of the software.
The steps involved in black box test case design
are: Graph based testing methods
Equivalence partitioning
Boundary value analysis
Comparison testing
Graph matrices

B. Tech Computer Science and Engineering Page 41


Rise Krishna Sai Prakasam Group of Institutions

6.3 TEST APPROACH


A Test Approach is the test system usage of a venture, characterizes
how testing would be done. The decision of test methodologies or test
technique is a standout amongst the most intense factor in the achievement of
the text exertion and precision of test designs and gauges.
Testing should be possible in two
ways: Bottom up approach
Top down approach
6.3.1 Bottom up Approach
The next testing method as the name suggests, which begins in construction
and testing with various atomic modules of the product i.e., modules or
functions at the lowest level. Because the all the functions or modules are
having integration between bottom up manner in which the processing is
required for the modules having connection to a given level is always available
and the need for remnant is eliminated.
6.3.2 Top down Approach
The next Testing process is top down integrations is an sequence approach
for construction and testing of a program structure. In a Software or product or
application various modules are integrated with each other by moving
downward through the systematic control hierarchy between the modules,
beginning with the main control or home control or index program. Various
activities or modules connected to the main program are included in the
structure of the project or either in the breath first or depth first manner.

B. Tech Computer Science and Engineering Page 42


Rise Krishna Sai Prakasam Group of Institutions

6.4 TEST CASES

Status
S No Input Expected Behavior Observed P=
behavior Passed
F=
Failed
1 Login as driver or Driver or user Driver or user Activity P
user with correct Activity Page should Page should be
login details be displayed displayed

2 Login as driver or Error message Error message P


user with wrong should be displayed should be
login details displayed

3 Driver Add Stages Mark the Stage in Mark the Stage in P


in Google Maps users maps. users maps.

4 Send Alerts to Users User can get alert User can get alert from P
from the Bus the Bus
5 Logout
Logout into the
Logout into the P
application.
application.

B. Tech Computer Science and Engineering Page 43


Rise Krishna Sai Prakasam Group of Institutions

CHAPTER 7
SCREENSHOTS

B. Tech Computer Science and Engineering Page 44


Rise Krishna Sai Prakasam Group of Institutions

Fig 7.1 Registration page

B. Tech Computer Science and Engineering Page 45


Rise Krishna Sai Prakasam Group of Institutions

Fig 7.2 Login Page

B. Tech Computer Science and Engineering Page 46


Rise Krishna Sai Prakasam Group of Institutions

––

Fig 7.3 Driver Activity Page

B. Tech Computer Science and Engineering Page 47


Rise Krishna Sai Prakasam Group of Institutions

Fig 7.4 Student Activity Page

B. Tech Computer Science and Engineering Page 48


Rise Krishna Sai Prakasam Group of Institutions

Fig 7.5 Driver and Student bus link page

B. Tech Computer Science and Engineering Page 49


Rise Krishna Sai Prakasam Group of Institutions

Fig 7.6 Add Stage


.

B. Tech Computer Science and Engineering Page 50


Rise Krishna Sai Prakasam Group of Institutions

Fig 7.7 User Location added

B. Tech Computer Science and Engineering Page 51


Rise Krishna Sai Prakasam Group of Institutions

Fig 7.8 Map

B. Tech Computer Science and Engineering Page 52


Rise Krishna Sai Prakasam Group of Institutions

Fig 7.9 Alert Message

B. Tech Computer Science and Engineering Page 53


Rise Krishna Sai Prakasam Group of Institutions

CHAPER 8
CONCLUSION

B. Tech Computer Science and Engineering Page 54


Rise Krishna Sai Prakasam Group of Institutions

8. CONCLUSION
 This application overcomes the problem of bus tracking. It is designed for users who’s
want to travel and saving time without wasting time in bus stops. This application
provides real time tracking to the users with the help of this application user can get
alerts from the bus before bus reaching his location.

 By using this application the user can travel freely and without taking any fear and
tensions. So that the user do not get delayed to reach their destinations.

 This system is reliable and very secure. Upgrading this setup is very easy which makes
it open to future requirements without the need of rebuilding everything from scrath,
which also makes it more efficient.

 This application presents the bus tracking application using smart phones. The
application consists  of both the transmitter and receiver inbuilt in mobile phones. The
transmitter is used to transmit the location and vehicle status in formation to the server.

 The receiver is the user who can view the details regarding the bus location using his
smart phone via Google map. Due to the movement of bus is always available this
project can also ensure security by keeping track of the bus. So in the coming year it is
going to play a major role in our day to day living.

B. Tech Computer Science and Engineering Page 55


Rise Krishna Sai Prakasam Group of Institutions

CHAPTER 9
FUTURE
ENHANCEMENT

B. Tech Computer Science and Engineering Page 56


Rise Krishna Sai Prakasam Group of Institutions

9. FUTURE ENHANCEMENT
 In future, We are also planning to fix a GPS device on every bus so that it is not
essential for the driver to have an Android  phone. Due to availability of android
phones and GPS devices it is going to stay for long in the future.

 The application will prove benificial for every bus traveler, or even tourists. Not just
buses, but this application will be useful for every person travelling by any means of
transport.

B. Tech Computer Science and Engineering Page 57


Rise Krishna Sai Prakasam Group of Institutions

CHAPTER 10
BIBLIOGRAPHY

B. Tech Computer Science and Engineering Page 58


B
Rise Krishna Sai Prakasam Group of Institutions

10. BIBILOGRAPHY
 Eddie Chi-Wah Lau, ‘‘Simple Bus Tracking System’’, Journal of Advanced Computer
Science and Technology Research, vol.3, no.1, 2013.

 Khondker Shajadul Hasan, Mashiur Rahman, Abul L. Haque, M Abdur Rahman, Tanzil
Rahman, and M Mahbubur Rasheed, “Cost Effective GPS-GPRS Based Object Tracking
System,” Proceedings of the International MultiConference of Engineers and Computer
Scientists 2009 (IMECS 2009), March 2009, Hong Kong, vol. 1.

 MZ Parvez, KZ Ahmed, QR Mahfuz, MS Rahman," A theoretical model of GSM


network based vehicle tracking system," 2010 International Conference on Electrical and
Computer Engineering (ICECE), Dec. 2010, pp. 594-597.

 https://www.dfrobot.com/wiki/index.php/GPS/GPRS/GSM_Module_
3.0_(SKU:TEL0051)

 http://javapapers.com/android/android-location-tracker-with-google-maps/

 http://www.codeproject.com/Articles/665527/A-GPS-Location-Plotting-Android-
application

 https://developer.android.com/guide/topics/location/strategies.html

 http://www.todroid.com/how-to-create-a-google-map-application-using-androidstudio/

B. Tech Computer Science and Engineering Page 59


B

You might also like