Abhii Final

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

A

PROJECT REPORT
ON
“Bus Tracking”

:: Submitted by ::
Mr. Abhishek Prabhakar Bagal
Mr. Omkar Sanjay Bhalewar

::Department of ::
COMPUTER ENGINEERING

GRAMIN POLYTECHNIC,
VISHNUPURI NANDED: - 431606
ACADEMIC YEAR
2020-21
A
PROJECT REPORT
ON
“Bus Tracking”

:: Submitted by ::
Mr. Abhishek Prabhakar Bagal
Mr. Omkar Sanjay Bhalewar

:: Guided by ::
Ms. Dudhmal M.N.
In partial fulfillment for the award of the diploma in
COMPUTER ENGINEERING

GRAMIN POLYTECHNIC,
VISHNUPURI NANDED: - 431606
ACADEMIC YEAR
2020-21
CERTIFICATE

This is to certify that project entitled “Bus Tracking” being submitted by Mr.
Abhishek Prabhakar Bagal, Mr.Omkar Sanjay Bhalewar to “Maharashtra State
Board of Technical Education, Mumbai” as a partial fulfillment of award of Diploma
in Computer Engineering, is record of bonafied work carried out by them under my
supervision and guidance. The matter contain in this project work has not been
submitted to any other institute for award of any degree or diploma.

( ) ( )
Mr.Wahi G.S Ms. Dudhmal M.N.

Head of Department Project Guide

( )
Dr. Pawar V.S.
Principal
PROJECT APPROVAL SHEET

Following team has done the appropriate work related to the “Bus-Tracking” in
partial fulfillment for the award of diploma in Computer Engineering of “MSBTE” and
is being submitted to Gramin Polytechnic Vishnupuri, Nanded.

Team:
Mr. Abhishek Prabhakar Bagal
Mr. Omkar Sanjay Bhalewar
Guide:
Ms. Dudhmal M.N.
Date:
Place: Nanded.

( ) ( )
Internal Examiner External Examiner
ACKNOWLEDGEMENT

We would like to thank our scheme, faculties and mentors for giving us the opportunity to
work under their guidance and help us in our final project. I would like to thank our beloved
principal Dr. Pawar V.S. who is the force behind this project. My sincere thanks to Ms. Dudhmal
M.N. as our internal project guide for giving us valuable inputs and ideas right from the selection
of topic for project till its successful completion.

I thank Mr. Wahi G.S (HOD of Computer Department) for his ongoing support and
encouragement in every aspect Last but not the least entire staff of Department of Computer
Engineering for guiding their thoughts and vision.

The successful completion of our final project report would not have been possible without
the dedicated support from all our mentors, family and friends. Finally, yet importantly I would
like to express my heartfelt thanks to my beloved parents for their blessings, my friends, and all
those who supported me directly or indirectly for their help and wishes for successful completion
of this project.

1. Mr. Abhishek Prabhakar Bagal


2. Mr. Omkar Sanjay Bhalewar
BUS Tracking System using Android

This project focuses on the development of a bus tracking system aimed at enhancing
transportation efficiency and passenger experience. The system utilizes GPS technology
to provide real-time tracking of bus locations, enabling passengers to access accurate
arrival times and optimize travel routes. With an emphasis on reducing travel costs and
minimizing time consumption, the system offers convenience by allowing users to track
buses from any location. Moreover, amidst the challenges posed by the COVID-19
pandemic, the system ensures passenger safety by minimizing physical interactions
through contactless tracking and notifications. By promoting digitization in public
transportation, the project aims to streamline operations, reduce management costs, and
deliver an improved and reliable bus tracking solution.
Advantages

1. Efficient Coordination: Streamlines transportation coordination through GPS and location


averaging.
2. Real-time Sharing: Enables real-time sharing of locations for accurate tracking.
3. Enhanced Safety: Improves safety by keeping passengers and crew informed of each other's
whereabouts.
4. Improved Experience: Enhances travel experience by reducing wait times and stress.
5. Cost-effectiveness: Provides cost-effective transportation coordination without significant
infrastructure investment.
.
Disadvantages
1. Dependency on GPS: Reliance on GPS technology may pose challenges in areas with
poor signal reception, leading to inaccurate location data.

2. Privacy Concerns: Users may have concerns about privacy when sharing their location
data, potentially leading to reluctance in using the application.

3. Technical Challenges: Developing and maintaining the application may require


continuous updates and troubleshooting to address technical issues and ensure reliability.

4. User Adoption: Some users may be hesitant to adopt new technology .


INDEX

Chapter Name of the Title Page

No. No.

1 Introduction 1

1.1 Aim of Project 1


1.2 Project Analysis 1
1.3. Scope of Project 1
1.4. Objectives 2
1.5. Features 2
1.6. Module 2
1.7 Software Requirement 3
1.8 Hardware Requirement 3

2 Literature Survey 4
2.1 Introduction 4
2.2 Technologies Used 4
3 System Requirements Specifications 6
3.1. Hardware Requirement 6

3.2. Software Requirement 6


4 System Design 7
4.1 Design Document 7

4.2. E-R Diagram 7

4.3 Data Flow Diagram 7

4.4. Undefined Modeling Diagram 8


4.5 Use Case Diagram 8
4.6 Flow Chart Diagram 11
4.7 Activity Diagram 21

5 System Implementation 22
5.1. User Application Coding 22

5.2. Common Classes both sides 55

5.3. Admin Application Coding 61

6 Testing 85
6.1 Testing 85
6.2 Testing Objectives 85
6.3 Levels of Testing 85
6.4 Types of Testing 86
6.5 White box testing 88
6.6 Black box testing 88
6.7 Test Case 88
7 Advantages 91
8 Conclusion 92
9 References 93
Bus-Tracking 2023-2024

CHAPTER 1
INTRODUCTION

1.1 AIM OF THE PROJECT


The aim of your project is to develop a bus tracking application that optimizes transportation
coordination by leveraging GPS technology and mathematical calculations. It aims to enhance
passenger experience, improve efficiency in bus operations, promote safety and security, and reduce
costs. Ultimately, the project aims to provide a convenient, reliable, and cost-effective solution for
tracking buses in real-time, thereby improving overall transportation services.

1.2 PROJECT ANALYSIS


Bus tracking project aims to develop a user-friendly application catering to commuters, schools, and
businesses. Leveraging GPS technology, the system provides real-time bus tracking, optimizing routes
and notifying users of delays. Essential features include intuitive interfaces for both passengers and
administrators. The project targets efficient transportation coordination, promoting safety, reducing
costs, and enhancing user experience. Through thorough analysis of market demands, technical
feasibility, and financial viability, the project aims to offer a reliable and accessible solution, ensuring
compliance with legal and ethical standards.

1.3 SCOPE OF THE PROJECT

The project's scope encompasses the development of a comprehensive bus tracking system. It includes
real-time tracking functionalities facilitated by GPS technology, enabling accurate location updates for
buses. The system will feature intuitive user interfaces tailored for both passengers and administrators,
ensuring accessibility and ease of use. Additionally, algorithms will be implemented to optimize bus
routes based on traffic conditions and passenger demand, enhancing efficiency. Timely notifications
will inform passengers of bus arrivals, delays, or route changes, improving the overall travel experience.
Robust data management protocols will ensure secure storage and processing of bus location data, while
integration with existing transportation infrastructure will facilitate seamless
operations.

Gramin Polytechnic Vishnupuri, Nanded. Page 1


Bus-Tracking 2023-2024

1.4 OBJECTIVES
 Improved Passenger Experience
 Enhanced Safety and Security
 Optimized Bus Operations
 Cost Savings
 Data-Driven Decision Making
 You can save your time.

1.5 FEATURES
 Real-time Bus Tracking
 Route Optimization
 Notifications
 User Interfaces
 Data Management
 Integration.
 All data store online.

1.6 MODULE

🠶 User

🠶 Admin

Gramin Polytechnic Vishnupuri, Nanded. Page 2


Bus-Tracking 2023-2024

1.7 SOFTWARE REQUIREMENTS

 Operating System : Windows


 Coding Language : Dart, Android
 Database : Server – Firebase
 IDE : Android Studio

1.8 HARDWARE REQUIREMENTS

 System : Intel 3,5,7


 Hard disk : 40 GB
 Ram : 4 GB

Gramin Polytechnic Vishnupuri, Nanded. Page 3


Bus-Tracking 2023-2024

CHAPTER 2

LITERATURE SURVEY

The bus tracking system presents an innovative solution to the challenges faced in public transportation by
leveraging modern technology. With the increasing demand for efficient and reliable transportation services, the
need for real-time tracking and optimization of bus routes has become paramount. This system aims to address
these needs by providing passengers with accurate information on bus locations, arrivals, and delays, thereby
enhancing their overall travel experience. By utilizing GPS technology and sophisticated algorithms, the system
optimizes bus operations, reduces wait times, and improves passenger safety. This introduction sets the stage for
exploring how the bus tracking system revolutionizes public transportation, offering convenience, efficiency,
and reliability to commuters and transportation authorities alike.
2.1 TECHNOLOGIES USED
This application uses mainly dart and some c++ technologies namely:

2.1.1 PROGRAMING LANGUAGE


 Java
Dart is a programming language developed by Google, designed for simplicity and productivity in
building fast and scalable applications. Introduced in 2011, Dart features a familiar syntax akin to Java
or JavaScript, making it accessible to developers. Its versatility allows compilation to native machine
code for desktop and mobile platforms, as well as to JavaScript for web development. Dart is widely
recognized for its integration with the Flutter framework, enabling the creation of native mobile apps
with rapid rendering and hot reload capabilities. With a growing community and active development,
Dart continues to gain popularity as a robust choice for modern app development.
 C++
C++ is a versatile programming language recognized for its efficiency and performance. Used across
various domains, it supports object-oriented programming, allowing for modular and reusable code.
With direct access to system resources, it's ideal for system-level development and performance-critical

Gramin Polytechnic Vishnupuri, Nanded. Page 4


Bus-Tracking 2023-2024
applications. Its Standard Template Library (STL) offers a rich collection of data structures and
algorithms. C++ is renowned for its cross-platform compatibility, enabling code to run on different
operating systems. Supported by a large community and extensive ecosystem, C++ remains a popular
choice for developers seeking speed, control, and flexibility in their projects.

2.1.2 TOOLS

 Android Studio (IDE) & Visual Studio


Android Studio. Android Studio is the official integrated development environment (IDE)
for Google's Android operating system, built on JetBrains' IntelliJ IDEA software and designed
specifically for Android development. It is available for download on Windows, MAC OS and
Linux based operating systems. The code editor helps you write better code, work faster, and be
more productive by offering advanced code completion, refactoring, and code analysis. As you
type, Android Studio provides suggestions in a dropdown list. Simply press Tab to insert the code.

2.1.3 DATABASE

PostGIS: An extension to PostgreSQL that adds support for geographic objects, making it suitable for
storing and querying spatial data such as GPS coordinates and routes.

Firebase Realtime Database: Offers real-time synchronization and updates, making it suitable for
tracking applications where immediate updates are required.

Gramin Polytechnic Vishnupuri, Nanded. Page 5


Bus-Tracking 2023-2024

CHAPTER 3
SYSTEM REQUIREMENT SPECIFICATIONS
A System requirement specification (abbreviated SRS when needed to be distinct from a SRS)
is structured collection of information that embodies the requirements of the system.

3.1 HARDWARE REQUIREMENT


The selection of hardware is very important in the existence and proper working of any
software. In the selection of hardware, the size and the capacity requirements are also important.
 Pentium processor -------- 233 MHZ or above
 RAM Capacity -------- 128MB
 Hard Disk -------- 20GB
 Floppy disk -------- 1.44 MB
 CD-ROM Drive -------- 32 HZ
 Keyboard -------- 108 Standard

3.2 SOFTWARE REQUIREMENTS


One of the most difficult tasks is that, the selection of the software, once system requirement
is known is determining whether a particular software package fits the requirements. After initial
selection further security is needed to determine the desirability of particular software compared with
other candidates. This section first summarizes the application requirement question and then suggests
more detailed comparisons.
 Operating System -------- Windows 95/98/NT/2000
 Browser -------- IE
 Web/Application Server -------- Java Web Server2.0
 Database Server -------- Oracle
 Database Connectivity -------- Dart:io
 Other Tools & Technologies -------- C++

Gramin Polytechnic Vishnupuri, Nanded. Page 6


Bus-Tracking 2023-2024

CHAPTER 4
SYSTEM DESIGN
4.1 DESIGN DOCUMENT

The entire system is projected with a physical diagram which specifics the actual storage parameters
that are physically necessary for any database to be stored on to the disk. The overall systems
existential idea is derived from this diagram.
The relation upon the system is structure through a conceptual ER-Diagram, which not only
specifics the existential entities but also the standard relations through which the system exists and
the cardinalities that are necessary for the system state to continue.

4.2 ER-DIAGRAM

 The entity Relationship Diagram (ERD) depicts the relationship between the data
objects. The ERD is the notation that is used to conduct the date modeling activity the
attributes of each data object noted is the ERD can be described resign a data object
descriptions.

 The set of primary components that are identified by the ERD are

 Data object

 Relationships

 Attributes

 Various types of indicators.

 The primary purpose of the ERD is to represent data objects and their relationships.

4.3 DATA FLOW DIAGRAM (DFD)


 The DFD is also called as bubble chart. It is a simple graphical formalism that can be
used to represent a system in terms of input data to the system, various processing
carried out on this data, and the output data is generated by this system. 
 The data flow diagram (DFD) is one of the most important modeling tools. It is used
to model the system components. These components are the system process, the data

Gramin Polytechnic Vishnupuri, Nanded. Page 7


Bus-Tracking 2023-2024

used by the process, an external entity that interacts with the system and the
information flows in the system.
 DFD shows how the information moves through the system and how it is modified by
a series of transformations. It is a graphical technique that depicts information flow
and the transformations that are applied as data moves from input to output
 DFD is also known as bubble chart. A DFD may be used to represent a system at any
level of abstraction. DFD may be partitioned into levels that represent increasing
information flow and functional detail. 

4.4 UNIFIED MODELING LANGUAGE DIAGRAMS (UML)

 The unified modeling language allows the software engineer to express an analysis model
using the modeling notation that is governed by a set of syntactic semantic and pragmatic
rules. 

 A UML system is represented using five different views that describe the system from
distinctly different perspective. Each view is defined by a set of diagram, which is as
follows.

 User Model View.

4.5 USE CASE DIAGRAM

A use case diagram shows a set of use cases and actors and their relationships. Use
case diagrams address the static use case view of a system. These diagrams are especially
important in organizing and modeling the behaviors of a system.

A use case diagram is a just a special kind of diagram and shares the same common
properties as do all other diagrams. A use case diagram differs from all other kinds of
diagrams in its particular content.

Gramin Polytechnic Vishnupuri, Nanded. Page 8


Bus-Tracking 2023-2024

4.5.1 Contents

Use case diagram commonly contain:

 Use case:

Use case is a description of set of sequence of actions that a system performs that
yields an observable result of value to a particular actor. A use case is used to structure the
behavioral things in a model. A use case is realized by collaboration. Graphically a use case
is rendered as an ellipse with solid lines, usually including only its name, as shown below.

Place order

Fig.4.5(a) Use Case

 Relationships:

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


thing may affect the semantics of the other thing. Graphically, a dependency is rendered as a
dashed line, possibly directed, and occasionally including a label. As in below.

Dependency

Fig.4.5(b) Dependency

An association is a structural relationship that describes a set of links, a link


being a connection among objects. Aggregation is a special kind of association, representing
a structural relationship between a whole and its parts. Graphically, an association is rendered
as a solid line, possibly directed, occasionally including a label.

0….1 *
Association

Fig.4.5(c) Association

Gramin Polytechnic Vishnupuri, Nanded. Page 9


Bus-Tracking 2023-2024

A generalization is a specialization / generalization relationship in which objects of


the specialized element (child) are substitutable for objects of the generalized element
(parent). Graphically, a generalization relationship is rendered as a solid line with a hollow
arrow head pointing to the parent.

Generalization

Fig.4.5(d) Generalization

4.5.1 USE CASE DIAGRAM

Fig.4.5.1 Use Case Diagram

Gramin Polytechnic Vishnupuri, Nanded. Page 10


Bus-Tracking 2023-2024

4.6 FLOW CHART DIAGRAMS

4.6.1 Flow Chart Diagram of Canteen Ordering System User App

Gramin Polytechnic Vishnupuri, Nanded. Page 11


Bus-Tracking 2023-2024

4.6.2 Flow Chart Diagram of Canteen Ordering System Admin App

Gramin Polytechnic Vishnupuri, Nanded. Page 12


Bus-Tracking 2023-2024

5.1.1 Flow Chart Diagram of Canteen Ordering System User App Register
Activity

Gramin Polytechnic Vishnupuri, Nanded. Page 13


Bus-Tracking 2023-2024

6.1.1 Flow Chart Diagram of Canteen Ordering System User App Home
Activity

Gramin Polytechnic Vishnupuri, Nanded. Page 14


Bus-Tracking 2023-2024

6.1.2 Flow Chart Cart Activity

Gramin Polytechnic Vishnupuri, Nanded. Page 15


Bus-Tracking 2023-2024

6.1.3 Flow Chart Diagram of Category Activity

Gramin Polytechnic Vishnupuri, Nanded. Page 16


Bus-Tracking 2023-2024

6.1.4 Flow Chart Diagram of Contact Us Activity

Gramin Polytechnic Vishnupuri, Nanded. Page 17


Bus-Tracking 2023-2024

6.1.5 Flow Chart Diagram of Admin Home Activity

Gramin Polytechnic Vishnupuri, Nanded. Page 18


Bus-Tracking 2023-2024

6.1.6 Sequence Diagram for Bus Tracking Activity

Gramin Polytechnic Vishnupuri, Nanded. Page 19


Bus-Tracking 2023-2024

4.6.9 Class Diagram For Bus Tracking Activity

Gramin Polytechnic Vishnupuri, Nanded. Page 20


Bus-Tracking 2023-2024

6.2 ACTIVITY DIAGRAM

6.2.1 Admin App Activity Diagram

6.2.2 User App Activity Diagram

Gramin Polytechnic Vishnupuri, Nanded. Page 21


Bus-Tracking 2023-2024

CHAPTER 5
SYSTEM IMPLEMENTION
5.1 USER APPLICATION CODING/IMPLEMENTATION

5.1.1 Welcome Screen:

import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/services.dart';
import 'registration_screen.dart';
import 'login_screen.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
import 'package:google_fonts/google_fonts.dart';

class welcomeScreen extends StatefulWidget {


const welcomeScreen({Key? key}) : super(key: key);

@override
State<welcomeScreen> createState() => _welcomeScreenState();
}

class _welcomeScreenState extends State<welcomeScreen> {

Future<bool?> _onBackPressed() async {


return showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('Do you want to exit?'),
actions: <Widget>[
TextButton(
child: Text('No'),
onPressed: () {
Navigator.of(context).pop(false);
},
),
TextButton(
child: Text('Yes'),
onPressed: () {
Navigator.of(context).pop(true);
SystemNavigator.pop();
},
),
Gramin Polytechnic Vishnupuri, Nanded. Page 22
Bus-Tracking 2023-2024
],
);
}
);
}

@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
bool? result = await _onBackPressed();
if (result == null) {
result = false;
}
return result;
},
child: Scaffold(
// return Scaffold(
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
children: [
Flexible(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: 20,
),
Lottie.asset('assets/images/bus.json'),
SizedBox(
height: 20,
),
Text(
"Welcome to \n KRU Bus Tracking",
style: GoogleFonts.poppins(
fontSize: 34, fontWeight: FontWeight.w700),
textAlign: TextAlign.center,
),
],
),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 38),
child: Container(
height: 65,
decoration: BoxDecoration(

Gramin Polytechnic Vishnupuri, Nanded. Page 23


Bus-Tracking 2023-2024
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.3),
spreadRadius: 2,
blurRadius: 3,
offset: Offset(0, 5))
],
color: Colors.deepPurple,
borderRadius: BorderRadius.circular(12),
),
child: Row(
children: [
Expanded(
child: GestureDetector(
onTap: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) =>
RegistrationScreen()));
},
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: Colors.deepPurple,
width: 0.9,
)
//textColor: Colors.black87,
),
child: const Center(
child: Text(
'Register',
style: TextStyle(
color: Colors.deepPurple,
fontWeight: FontWeight.bold,
fontSize: 15,
),
),
),
),
),
),
Expanded(
child: GestureDetector(
//bgColor: Colors.transparent,
//buttonName: 'Sign In',

Gramin Polytechnic Vishnupuri, Nanded. Page 24


Bus-Tracking 2023-2024
onTap: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => LoginScreen(),
));
},
child: Container(
decoration: BoxDecoration(
color: Colors.deepPurple,
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: Colors.deepPurple,
width: 0.9,
)
//textColor: Colors.black87,
),
child: const Center(
child: Text(
'Login',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 15,
),
),
),
),
),
),
],
),
),
),
],
),
),
),
)
);
}
}

Gramin Polytechnic Vishnupuri, Nanded. Page 25


Bus-Tracking 2023-2024

5.1.2 Home screen Activity:

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:email_password_login/model/shared_preference.dart';
import 'package:email_password_login/model/user_model.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'login_screen.dart';

class HomeScreen extends StatefulWidget {


const HomeScreen({Key? key}) : super(key: key);

Gramin Polytechnic Vishnupuri, Nanded. Page 26


Bus-Tracking 2023-2024

@override
_HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {


User? user = FirebaseAuth.instance.currentUser;
UserModel loggedInUser = UserModel();

PrefService _prefService = PrefService();

Future<bool?> _onBackPressed() async {


return showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('Do you want to exit?'),
actions: <Widget>[
TextButton(
child: Text('No'),
onPressed: () {
Navigator.of(context).pop(false);
},
),
TextButton(
child: Text('Yes'),
onPressed: () {
Navigator.of(context).pop(true);
SystemNavigator.pop();
},
),
],
);
});
}

final Stream<QuerySnapshot>users=
FirebaseFirestore.instance.collection('users').snapshots();

@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
bool? result = await _onBackPressed();
if (result == null) {
result = false;
}
return result;

Gramin Polytechnic Vishnupuri, Nanded. Page 27


Bus-Tracking 2023-2024
},
child: new Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: IconButton(
icon: Icon(
Icons.arrow_back,
color: Colors.black,
size: 30,
),
onPressed: () {
_onBackPressed();
},
),
),
body: Center(
child: Padding(
padding: EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 150,
child: Image.asset("assets/images/logo.png",
fit: BoxFit.contain),
),
Text(
"Welcome Back",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.black),
),
SizedBox(
height: 10,
),
Container(
height:250,
padding:const EdgeInsets.symmetric(vertical:20),
child:StreamBuilder<QuerySnapshot>(
stream:users,
builder:(
BuildContext context,
AsyncSnapshot<QuerySnapshot>snapshot,){
if(snapshot.hasError){

Gramin Polytechnic Vishnupuri, Nanded. Page 28


Bus-Tracking 2023-2024
return Text('Something went wrong.');
}
if(snapshot.connectionState == ConnectionState.waiting){
return Text('Loading');
}
final data=snapshot.requireData;

return ListView.builder(
itemCount:data.size,
itemBuilder:(context,index){
return Text('${data.docs[index]['fullname']} ${data.docs[index]['email']}');
}
);
}
)
),
// Text("${loggedInUser.fullName}",
// style: TextStyle(
// color: Colors.black54,
// fontWeight: FontWeight.w500,
// )),
// Text("${loggedInUser.email}",
// style: TextStyle(
// color: Colors.black54,
// fontWeight: FontWeight.w500,
// )),
// SizedBox(
// height: 15,
// ),
ActionChip(
label: Text("Logout"),
onPressed: () async {
await _prefService
.removeCache("email", "password")
.whenComplete(() => {
logout(context),
});
}
),
],
),
),
)
)
);
}

// the logout function

Gramin Polytechnic Vishnupuri, Nanded. Page 29


Bus-Tracking 2023-2024
Future<void> logout(BuildContext context) async {
await FirebaseAuth.instance.signOut();
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (context) => LoginScreen()));
}
}

5.1.3 Signup/Register Activity

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:email_password_login/model/routes.dart';
import 'package:email_password_login/model/user_model.dart';
import 'package:email_password_login/screens/welcome_screen.dart';
import 'package:fluttertoast/fluttertoast.dart';

Gramin Polytechnic Vishnupuri, Nanded. Page 30


Bus-Tracking 2023-2024

import 'package:firebase_database/firebase_database.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:lottie/lottie.dart';
import 'home_screen.dart';
import 'login_screen.dart';

class RegistrationScreen extends StatefulWidget {


const RegistrationScreen({Key? key}) : super(key: key);

@override
_RegistrationScreenState createState() => _RegistrationScreenState();
}

class _RegistrationScreenState extends State<RegistrationScreen> {


final _auth = FirebaseAuth.instance;
FirebaseDatabase database = FirebaseDatabase.instance;

// string for displaying the error Message


String? errorMessage;

bool _obscureText = true;


bool obscureText = true;

var _fullname = '';


var _email = '';

// our form key


final _formKey = GlobalKey<FormState>();

// editing Controller
final fullnameEditingController = new TextEditingController();
final emailEditingController = new TextEditingController();
final passwordEditingController = new TextEditingController();
final confirmPasswordEditingController = new TextEditingController();

Gramin Polytechnic Vishnupuri, Nanded. Page 31


Bus-Tracking 2023-2024

final Stream<QuerySnapshot> users =


FirebaseFirestore.instance.collection('users').snapshots();

@override
Widget build(BuildContext context) {
//first name field
final fullnameField = TextFormField(
autofocus: false,
controller: fullnameEditingController,
keyboardType: TextInputType.name,
validator: (value) {
RegExp regex = new RegExp(r'^.{3,}$');
if (value!.isEmpty) {
return ("Full Name cannot be Empty");
}
if (!regex.hasMatch(value)) {
return ("Enter Valid name(Min. 3 Character)");
}
return null;
},
onSaved: (value) {
fullnameEditingController.text = value!;
},
textInputAction: TextInputAction.next,
decoration: InputDecoration(
prefixIcon: Icon(Icons.account_circle),
contentPadding: EdgeInsets.fromLTRB(20, 15, 20, 15),
hintText: "Full Name",
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
),
));

//email field
final emailField = TextFormField(
autofocus: false,
controller: emailEditingController,

Gramin Polytechnic Vishnupuri, Nanded. Page 32


Bus-Tracking 2023-2024

keyboardType: TextInputType.emailAddress,
validator: (value) {
if (value!.isEmpty) {
return ("Please Enter Your Email");
}
// reg expression for email validation
if (!RegExp("^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+.[a-z]")
.hasMatch(value)) {
return ("Please Enter a valid email");
}
return null;
},
onSaved: (value) {
fullnameEditingController.text = value!;
},
textInputAction: TextInputAction.next,
decoration: InputDecoration(
prefixIcon: Icon(Icons.mail),
contentPadding: EdgeInsets.fromLTRB(20, 15, 20, 15),
hintText: "Email",
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
),
));

//password field
final passwordField = TextFormField(
autofocus: false,
controller: passwordEditingController,
obscureText: _obscureText,
validator: (value) {
RegExp regex = new RegExp(r'^.{6,}$');
if (value!.isEmpty) {
return ("Password is required");
}
if (!regex.hasMatch(value)) {
return ("Enter Valid Password(Min. 6 Character)");

Gramin Polytechnic Vishnupuri, Nanded. Page 33


Bus-Tracking 2023-2024

}
},
onSaved: (value) {
fullnameEditingController.text = value!;
},
textInputAction: TextInputAction.next,
decoration: InputDecoration(
prefixIcon: Icon(Icons.vpn_key),
contentPadding: EdgeInsets.fromLTRB(20, 15, 20, 15),
hintText: "Password",
suffixIcon: GestureDetector(
onTap: () {
setState(() {
_obscureText = !_obscureText;
});
},
child: Icon(
_obscureText ? Icons.visibility : Icons.visibility_off,
),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
),
));

//confirm password field


final confirmPasswordField = TextFormField(
autofocus: false,
controller: confirmPasswordEditingController,
obscureText: obscureText,
validator: (value) {
if (value!.isEmpty) {
return ("Password is required");
}
if (confirmPasswordEditingController.text !=
passwordEditingController.text) {
return "Password don't match";

Gramin Polytechnic Vishnupuri, Nanded. Page 34


Bus-Tracking 2023-2024

}
return null;
},
onSaved: (value) {
confirmPasswordEditingController.text = value!;
},
textInputAction: TextInputAction.done,
decoration: InputDecoration(
prefixIcon: Icon(Icons.vpn_key),
contentPadding: EdgeInsets.fromLTRB(20, 15, 20, 15),
hintText: "Confirm Password",
suffixIcon: GestureDetector(
onTap: () {
setState(() {
obscureText = ! obscureText;
});
},
child: Icon(
obscureText ? Icons.visibility : Icons.visibility_off,
),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
),
));

//signup button
final signUpButton = Material(
elevation: 5,
borderRadius: BorderRadius.circular(10),
color: Colors.deepPurple,
child: MaterialButton(
padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
minWidth: MediaQuery.of(context).size.width,
onPressed: () {
signUp(emailEditingController.text, passwordEditingController.text);
},

Gramin Polytechnic Vishnupuri, Nanded. Page 35


Bus-Tracking 2023-2024

child: Text(
"SignUp",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20, color: Colors.white, fontWeight: FontWeight.bold),
)),
);

return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: IconButton(
icon: Icon(
Icons.arrow_back,
color: Colors.black,
size: 30,
),
onPressed: () {
// passing this to our root
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (context) => welcomeScreen()));
},
),
),
body: Center(
child: SingleChildScrollView(
child: Container(
color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(36),
child: Form(
key: _formKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,

Gramin Polytechnic Vishnupuri, Nanded. Page 36


Bus-Tracking 2023-2024

children: <Widget>[
Lottie.asset(
'assets/images/sign-up.json',
width: 140,
height: 140,
),
SizedBox(
height: 15,
),
Text(
'Registeration',
style: GoogleFonts.poppins(
color: Colors.black,
fontSize: 34,
fontWeight: FontWeight.w700),
),
SizedBox(height: 45),
fullnameField,
SizedBox(height: 20),
emailField,
SizedBox(height: 20),
passwordField,
SizedBox(height: 20),
confirmPasswordField,
SizedBox(height: 20),
signUpButton,
SizedBox(height: 15),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text("Already registered? "),
GestureDetector(
onTap: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => LoginScreen()));

Gramin Polytechnic Vishnupuri, Nanded. Page 37


Bus-Tracking 2023-2024

},
child: Text(
"Login",
style: TextStyle(
color: Colors.deepPurple,
fontWeight: FontWeight.bold,
fontSize: 15),
),
)
],
),
],
),
),
),
),
),
),
);
}

void signUp(String email, String password) async {


showDialog(
context: context,
builder: (context) {
return Center(
child: CircularProgressIndicator(
color: Colors.deepPurple,
));
},
);

if (_formKey.currentState!.validate()) {
try {
await _auth
.createUserWithEmailAndPassword(email: email, password: password)
.then((value) => {afterThen()});

Gramin Polytechnic Vishnupuri, Nanded. Page 38


Bus-Tracking 2023-2024

// .then((value) => {postDetailsToFirestore()});


// Navigator.of(context).pop;
// Navigator.of(context).pushReplacementNamed(loginRoute);
Fluttertoast.showToast(msg: "User Successfully Registered")
.catchError((e) {
Fluttertoast.showToast(msg: e!.message);
});
} on FirebaseAuthException catch (error) {
switch (error.code) {
case "invalid-email":
errorMessage = "Your email address appears to be malformed.";
break;
case "wrong-password":
errorMessage = "Your password is wrong.";
break;
case "user-not-found":
errorMessage = "User with this email doesn't exist.";
break;
case "user-disabled":
errorMessage = "User with this email has been disabled.";
break;
case "too-many-requests":
errorMessage = "Too many requests";
break;
case "operation-not-allowed":
errorMessage = "Signing in with Email and Password is not enabled.";
break;
default:
errorMessage = "An undefined Error happened.";
}
Fluttertoast.showToast(msg: errorMessage!);
print(error.code);
}
}
}

void afterThen() {

Gramin Polytechnic Vishnupuri, Nanded. Page 39


Bus-Tracking 2023-2024

(value) => {postDetailsToFirestore()};


// Navigator.of(context).pop;
// Navigator.of(context).pushReplacementNamed(loginRoute);
// Fluttertoast.showToast(msg: "User Successfully Registered");
}

postDetailsToFirestore() async {
// calling our firestore
// calling our user model
// sedning these values

FirebaseFirestore firebaseFirestore = FirebaseFirestore.instance;


User? user = _auth.currentUser;

UserModel userModel = UserModel();

// writing all the values


userModel.email = user!.email;
userModel.uid = user.uid;
userModel.fullName = fullnameEditingController.text;

await firebaseFirestore
.collection("users")
.doc(user.uid)
.set(userModel.toMap());
Navigator.of(context).pop;
Navigator.of(context).pushReplacementNamed(loginRoute);
Fluttertoast.showToast(msg: "User Successfully Registered");

}
}

Gramin Polytechnic Vishnupuri, Nanded. Page 40


Bus-Tracking 2023-2024

5.1.4 Reset Passward

Gramin Polytechnic Vishnupuri, Nanded. Page 41


Bus-Tracking 2023-2024

import 'package:email_password_login/screens/login_screen.dart';
import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:lottie/lottie.dart';

class ForgotPassword extends StatefulWidget {


const ForgotPassword({Key? key}) : super(key: key);

@override
State<ForgotPassword> createState() =>
_ForgotPasswordState();
}

class _ForgotPasswordState extends State<ForgotPassword> {


final _formKey = GlobalKey<FormState>();

final _auth = FirebaseAuth.instance;

String? errorMessage;

final TextEditingController emailController = new


TextEditingController();

@override
Widget build(BuildContext context) {
//email field
final emailField = TextFormField(
autofocus: false,
controller: emailController,
keyboardType: TextInputType.emailAddress,
validator: (value) {
if (value!.isEmpty) {

Gramin Polytechnic Vishnupuri, Nanded. Page 42


Bus-Tracking 2023-2024

return ("Please Enter Your child: MaterialButton(


Email"); padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
} minWidth: MediaQuery.of(context).size.width,
// reg expression for email onPressed: () {
validation signIn(emailController.text);
if (!RegExp("^[a-zA-Z0-9+_.- },
]+@[a-zA-Z0-9.-]+.[a-z]") child: Text(
.hasMatch(value)) { "Get Link",
return ("Please Enter a valid textAlign: TextAlign.center,
email"); style: TextStyle(
}
fontSize: 20, color: Colors.white, fontWeight:
return null; FontWeight.bold),
}, )),
onSaved: (value) { );
emailController.text = value!;
}, return Scaffold(
textInputAction: backgroundColor: Colors.white,
TextInputAction.next,
appBar: AppBar(
decoration: InputDecoration(
backgroundColor: Colors.transparent,
prefixIcon: Icon(Icons.mail),
elevation: 0,
contentPadding: leading: IconButton(
EdgeInsets.fromLTRB(20, 15, 20,
icon: Icon(
15),
Icons.arrow_back,
hintText: "Email",
color: Colors.black,
border: OutlineInputBorder(
size: 30,
borderRadius:
BorderRadius.circular(10), ),
), onPressed: () {
)); // passing this to our root
Navigator.of(context).pushReplacement(
final loginButton = Material( MaterialPageRoute(builder: (context) =>
LoginScreen()));
elevation: 5,
},
borderRadius:
BorderRadius.circular(10), ),
color: Colors.deepPurple, ),

Gramin Polytechnic Vishnupuri, Nanded. Page 43


Bus-Tracking 2023-2024

body: Center( loginButton,


child: SingleChildScrollView( SizedBox(height: 15),
child: Container( ]),
color: Colors.white, ),
child: Padding( ),
padding: const ),
EdgeInsets.all(36), ),
child: Form( ),
key: _formKey, );
child: Column( }
mainAxisAlignment:
MainAxisAlignment.center, // login function
crossAxisAlignment: void signIn(String email) async {
CrossAxisAlignment.center, showDialog(
children: <Widget>[ context: context,
Lottie.asset( builder: (context) {
'assets/images/reset- return Center(
password.json',
child: CircularProgressIndicator(
width: 140,
color: Colors.deepPurple,
height: 140,
));
),
},
SizedBox(
);
height: 15,
),
if (_formKey.currentState!.validate()) {
Text(
try {
'Reset Password',
await _auth.sendPasswordResetEmail(email: email)
style:
.then((uid) => {
GoogleFonts.poppins(
Fluttertoast.showToast(msg: "Reset mail sent, Please
fontSize: 34,
check your SPAM"),
fontWeight: FontWeight.w600),
}
),
);
SizedBox(height: 25),
} on FirebaseAuthException catch (error) {
emailField,
switch (error.code) {
SizedBox(height: 25),
case "invalid-email":

Gramin Polytechnic Vishnupuri, Nanded. Page 44


Bus-Tracking 2023-2024

errorMessage = "Your email Navigator.of(context).pushReplacement(MaterialPageRoute(buil


address appears to be malformed."; der: (context) => LoginScreen()));
break; }
case "wrong-password": }
errorMessage = "Your
password is wrong.";
break;
case "user-not-found":
errorMessage = "User with
this email doesn't exist.";
break;
case "user-disabled":
errorMessage = "User with
this email has been disabled.";
break;
case "too-many-requests":
errorMessage = "Too many
requests";
break;
case "operation-not-allowed":
errorMessage = "Signing in
with Email and Password is not
enabled.";
break;
default:
errorMessage = "An undefined
Error happened.";
}
Fluttertoast.showToast(msg:
errorMessage!);
print(error.code);
}
}
Navigator.of(context).pop;

Gramin Polytechnic Vishnupuri, Nanded. Page 45


Bus-Tracking 2023-2024

Gramin Polytechnic Vishnupuri, Nanded. Page 46


Bus-Tracking 2023-2024

Passanger Mode

import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:firebase_database/firebase_database.dart';

class PassengerMode extends StatefulWidget {


@override
_PassengerModeState createState() => _PassengerModeState();
}

class _PassengerModeState extends State<PassengerMode> {


DatabaseReference _databaseRef = FirebaseDatabase.instance.reference();

late Position _currentPosition;

@override
void initState() {
super.initState();
_getCurrentLocation();
}

void _getCurrentLocation() async {


Position position = await Geolocator.getCurrentPosition(
desiredAccuracy: LocationAccuracy.high);
setState(() {
_currentPosition = position;
});
_uploadLocationToDatabase(position.latitude, position.longitude);
}

void _uploadLocationToDatabase(double latitude, double longitude) {


_databaseRef.push().set({
'latitude': latitude,
'longitude': longitude,
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Passenger Mode'),
),
body: Center(
Gramin Polytechnic Vishnupuri, Nanded. Page 47
Bus-Tracking 2023-2024
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('Latitude: ${_currentPosition.latitude}'),
Text('Longitude: ${_currentPosition.longitude}'),
],
),
),
);
}
}

Gramin Polytechnic Vishnupuri, Nanded. Page 48


Bus-Tracking 2023-2024

Waiting Mode

import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:firebase_database/firebase_database.dart';

class WaitingMode extends StatefulWidget {


@override
_WaitingModeState createState() => _WaitingModeState();
}

class _WaitingModeState extends State<WaitingMode> {


DatabaseReference _databaseRef = FirebaseDatabase.instance.reference();
List<Marker> _markers = [];

@override
void initState() {
super.initState();
_getPassengerLocations();
}

void _getPassengerLocations() {
_databaseRef.onChildAdded.listen((event) {
Map<String, dynamic> data = event.snapshot.value as Map<String, dynamic>;
double latitude = data['latitude'];
double longitude = data['longitude'];
setState(() {
_markers.add(
Marker(
markerId: MarkerId(event.snapshot.key ?? ""),
position: LatLng(latitude, longitude),
),
);
});
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(

Gramin Polytechnic Vishnupuri, Nanded. Page 49


Bus-Tracking 2023-2024
title: Text('Waiting Mode'),
),
body: GoogleMap(
initialCameraPosition: CameraPosition(
target: LatLng(0, 0),
zoom: 15,
),
markers: Set<Marker>.of(_markers),
),
);
}
}

Gramin Polytechnic Vishnupuri, Nanded. Page 50


Bus-Tracking 2023-2024

Location provider

import 'package:flutter/cupertino.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:location/location.dart';
import 'dart:async';

class LocationProvider with ChangeNotifier {


late Location _location;
Location get location => _location;
late LatLng _locationPosition;
LatLng get locationposition => _locationPosition;

bool locationServiceActive = true;

LocationProvider() {
_location = Location();
}

initalization() async {
await getUserLocation();
}

getUserLocation() async {
bool serviceEnabled;
PermissionStatus permissionGranted;

serviceEnabled = await location.serviceEnabled();


if (!serviceEnabled) {
serviceEnabled = await location.requestService();

if (!serviceEnabled) {
return;
}
}

permissionGranted = await location.hasPermission();


if (permissionGranted == PermissionStatus.denied) {
permissionGranted = await location.requestPermission();
if (permissionGranted != PermissionStatus.granted) {
return;
}
}
Gramin Polytechnic Vishnupuri, Nanded. Page 51
Bus-Tracking 2023-2024

location.onLocationChanged.listen(
(LocationData currenLocation) {
_locationPosition = LatLng(
currenLocation.latitude!,
currenLocation.longitude!,
);
},
);
}
}

Gramin Polytechnic Vishnupuri, Nanded. Page 52


Bus-Tracking 2023-2024

Code for Google Map


// // ignore_for_file: deprecated_member_use

// import 'dart:async';

// import 'package:curved_navigation_bar/curved_navigation_bar.dart';
// import 'package:firebase_auth/firebase_auth.dart';
// import 'package:flutter/cupertino.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter/services.dart';
// import 'package:flutter_polyline_points/flutter_polyline_points.dart';
// import 'package:google_maps_flutter/google_maps_flutter.dart';
// import 'package:location/location.dart';

// import '../login/login/login_screen.dart';
// import '../model/shared_preference.dart';
// import '../screens/home.dart';
// import 'google_map copy.dart';
// import 'google_map_api.dart';

// class LocationTracking extends StatefulWidget {


// const LocationTracking({Key? key}) : super(key: key);

// @override
// _LocationTrackingState createState() => _LocationTrackingState();
// }

// class _LocationTrackingState extends State<LocationTracking> {


// LatLng sourceLocation = LatLng(28.432864, 77.002563);
// LatLng destinationLatlng = LatLng(28.431626, 77.002475);
// PrefService _prefService = PrefService();

// Completer<GoogleMapController> _controller = Completer();

// Set<Marker> _marker = Set<Marker>();

// Set<Polyline> _polylines = Set<Polyline>();


// List<LatLng> polylineCoordinates = [];
// late PolylinePoints polylinePoints;

// late StreamSubscription<LocationData> subscription;

Gramin Polytechnic Vishnupuri, Nanded. Page 53


Bus-Tracking 2023-2024

// LocationData? currentLocation;
// late LocationData destinationLocation;
// late Location location;

// int index = 1;

// Future<bool?> _onBackPressed() async {


// return showDialog(
// context: context,
// builder: (BuildContext context) {
// return AlertDialog(
// title: Text('Do you want to exit?'),
// actions: <Widget>[
// TextButton(
// child: Text('No'),
// onPressed: () {
// Navigator.of(context).pop(false);
// },
// ),
// TextButton(
// child: Text('Yes'),
// onPressed: () {
// Navigator.of(context).pop(true);
// SystemNavigator.pop();
// },
// ),
// ],
// );
// });
// }

// @override
// void initState() {
// super.initState();

// location = Location();
// polylinePoints = PolylinePoints();

// subscription = location.onLocationChanged.listen((clocation) {
// currentLocation = clocation;

Gramin Polytechnic Vishnupuri, Nanded. Page 54


Bus-Tracking 2023-2024
// updatePinsOnMap();
// });

// setInitialLocation();
// }

// void setInitialLocation() async {


// await location.getLocation().then((value) {
// currentLocation = value;
// setState(() {});
// });

// destinationLocation = LocationData.fromMap({
// "latitude": destinationLatlng.latitude,
// "longitude": destinationLatlng.longitude,
// });
// }

// void showLocationPins() {
// var sourceposition = LatLng(
// currentLocation!.latitude ?? 0.0, currentLocation!.longitude ?? 0.0);

// var destinationPosition =
// LatLng(destinationLatlng.latitude, destinationLatlng.longitude);

// _marker.add(Marker(
// markerId: MarkerId('sourcePosition'),
// position: sourceposition,
// ));

// _marker.add(
// Marker(
// markerId: MarkerId('destinationPosition'),
// position: destinationPosition,
// ),
// );

// setPolylinesInMap();
// }

// void setPolylinesInMap() async {


// var result = await polylinePoints.getRouteBetweenCoordinates(

Gramin Polytechnic Vishnupuri, Nanded. Page 55


Bus-Tracking 2023-2024
// GoogleMapApi().url,
// PointLatLng(
// currentLocation!.latitude ?? 0.0, currentLocation!.longitude ?? 0.0),
// PointLatLng(destinationLatlng.latitude, destinationLatlng.longitude),
// );

// if (result.points.isNotEmpty) {
// result.points.forEach((pointLatLng) {
// polylineCoordinates
// .add(LatLng(pointLatLng.latitude, pointLatLng.longitude));
// });
// }

// setState(() {
// _polylines.add(Polyline(
// width: 5,
// polylineId: PolylineId('polyline'),
// color: Colors.blueAccent,
// points: polylineCoordinates,
// ));
// });
// }

// void updatePinsOnMap() async {


// CameraPosition cameraPosition = CameraPosition(
// zoom: 20,
// target: LatLng(
// currentLocation!.latitude ?? 0.0, currentLocation!.longitude ?? 0.0),
// );

// final GoogleMapController controller = await _controller.future;

// controller.animateCamera(CameraUpdate.newCameraPosition(cameraPosition));

// var sourcePosition = LatLng(


// currentLocation!.latitude ?? 0.0, currentLocation!.longitude ?? 0.0);

// setState(() {
// _marker.removeWhere((marker) => marker.mapsId.value == 'sourcePosition');

// _marker.add(Marker(
// markerId: MarkerId('sourcePosition'),

Gramin Polytechnic Vishnupuri, Nanded. Page 56


Bus-Tracking 2023-2024
// position: sourcePosition,
// ));
// });
// }

// @override
// Widget build(BuildContext context) {
// CameraPosition initialCameraPosition = CameraPosition(
// zoom: 20,
// tilt: 80,
// bearing: 30,
// target: currentLocation != null
// ? LatLng(currentLocation!.latitude ?? 0.0,
// currentLocation!.longitude ?? 0.0)
// : LatLng(0.0, 0.0),
// );

// return currentLocation == null


// ? Container(
// height: MediaQuery.of(context).size.height,
// width: MediaQuery.of(context).size.width,
// alignment: Alignment.center,
// child: CircularProgressIndicator(),
// )
// : SafeArea(
// child: WillPopScope(
// onWillPop: () async {
// bool? result = await _onBackPressed();
// if (result == null) {
// result = false;
// }
// return result;
// },
// child: Scaffold(
// bottomNavigationBar: CurvedNavigationBar(
// index: 0,
// backgroundColor: Colors.transparent,
// color: Colors.deepPurple,
// animationDuration: const Duration(milliseconds: 300),
// height: 60,
// items: [
// IconButton(

Gramin Polytechnic Vishnupuri, Nanded. Page 57


Bus-Tracking 2023-2024
// icon: Icon(
// Icons.directions_bus_filled_rounded,
// color: Colors.white,
// ),
// onPressed: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// const LocationTracking()),
// );
// }),
// IconButton(
// icon: Icon(
// Icons.home,
// color: Colors.white,
// ),
// onPressed: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => const Home()),
// );
// }),
// IconButton(
// icon: Icon(
// Icons.person_pin_circle_rounded,
// color: Colors.white,
// ),
// onPressed: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => const LocationTrack()),
// );
// }),
// ]),
// //extendBodyBehindAppBar: true,
// appBar: AppBar(
// //toolbarHeight: 70,
// brightness: Brightness.dark,
// title: const Text(

Gramin Polytechnic Vishnupuri, Nanded. Page 58


Bus-Tracking 2023-2024
// 'KRU BUSES',
// style: TextStyle(
// color: Colors.deepPurple,
// fontSize: 24,
// fontWeight: FontWeight.bold),
// ),

// centerTitle: true,
// backgroundColor: Colors.transparent,
// elevation: 4.0,
// flexibleSpace: Container(
// decoration: const BoxDecoration(
// borderRadius: BorderRadius.only(
// bottomLeft: Radius.circular(20),
// bottomRight: Radius.circular(20)),
// color: Colors.white),
// ),
// actions: [
// IconButton(
// icon: Icon(
// Icons.logout_rounded,
// color: Colors.black,
// ),
// onPressed: () async {
// await _prefService
// .removeCache("email", "password")
// .whenComplete(() => {
// logout(context),
// });
// },
// )
// ],
// ),

// body: GoogleMap(
// myLocationButtonEnabled: true,
// myLocationEnabled: true,
// //compassEnabled: true,
// markers: _marker,
// polylines: _polylines,
// mapType: MapType.normal,
// initialCameraPosition: initialCameraPosition,

Gramin Polytechnic Vishnupuri, Nanded. Page 59


Bus-Tracking 2023-2024
// onMapCreated: (GoogleMapController controller) {
// _controller.complete(controller);
// showLocationPins();
// },
// ),
// ),
// ),
// );
// }

// // the logout function


// Future<void> logout(BuildContext context) async {
// await FirebaseAuth.instance.signOut();
// Navigator.of(context).pushReplacement(
// MaterialPageRoute(builder: (context) => LoginScreen()));
// }

// @override
// void dispose() {
// subscription.cancel();
// super.dispose();
// }
// }

import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:firebase_database/firebase_database.dart';

class PassengerMode extends StatefulWidget {


@override
_PassengerModeState createState() => _PassengerModeState();
}

class _PassengerModeState extends State<PassengerMode> {


DatabaseReference _databaseRef = FirebaseDatabase.instance.reference();

late Position _currentPosition;

@override
void initState() {
super.initState();
_getCurrentLocation();

Gramin Polytechnic Vishnupuri, Nanded. Page 60


Bus-Tracking 2023-2024
}

void _getCurrentLocation() async {


Position position = await Geolocator.getCurrentPosition(
desiredAccuracy: LocationAccuracy.high);
setState(() {
_currentPosition = position;
});
_uploadLocationToDatabase(position.latitude, position.longitude);
}

void _uploadLocationToDatabase(double latitude, double longitude) {


_databaseRef.push().set({
'latitude': latitude,
'longitude': longitude,
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Passenger Mode'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('Latitude: ${_currentPosition.latitude}'),
Text('Longitude: ${_currentPosition.longitude}'),
],
),
),
);
}
}

MAP style.Dart Code


class MapStyle {
final String aubergine = """
[
Gramin Polytechnic Vishnupuri, Nanded. Page 61
Bus-Tracking 2023-2024
{
"elementType": "geometry",
"stylers": [
{
"color": "#1d2c4d"
}
]
},
{
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#8ec3b9"
}
]
},
{
"elementType": "labels.text.stroke",
"stylers": [
{
"color": "#1a3646"
}
]
},
{
"featureType": "administrative.country",
"elementType": "geometry.stroke",
"stylers": [
{
"color": "#4b6878"
}
]
},
{
"featureType": "administrative.land_parcel",
"elementType": "labels.text.fill",
Gramin Polytechnic Vishnupuri, Nanded. Page 62
Bus-Tracking 2023-2024
"stylers": [
{
"color": "#64779e"
}
]
},
{
"featureType": "administrative.province",
"elementType": "geometry.stroke",
"stylers": [
{
"color": "#4b6878"
}
]
},
{
"featureType": "landscape.man_made",
"elementType": "geometry.stroke",
"stylers": [
{
"color": "#334e87"
}
]
},
{
"featureType": "landscape.natural",
"elementType": "geometry",
"stylers": [
{
"color": "#023e58"
}
]
},
{
"featureType": "poi",
"elementType": "geometry",
Gramin Polytechnic Vishnupuri, Nanded. Page 63
Bus-Tracking 2023-2024
"stylers": [
{
"color": "#283d6a"
}
]
},
{
"featureType": "poi",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#6f9ba5"
}
]
},
{
"featureType": "poi",
"elementType": "labels.text.stroke",
"stylers": [
{
"color": "#1d2c4d"
}
]
},
{
"featureType": "poi.park",
"elementType": "geometry.fill",
"stylers": [
{
"color": "#023e58"
}
]
},
{
"featureType": "poi.park",
"elementType": "labels.text.fill",
Gramin Polytechnic Vishnupuri, Nanded. Page 64
Bus-Tracking 2023-2024

"stylers": [
{
"color": "#757575"
}
]
},
{
"featureType": "road.highway",
"elementType": "geometry",
"stylers": [
{
"color": "#dadada"
}
]
},
{
"featureType": "road.highway",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#616161"
}
]
},
{
"featureType": "road.local",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#9e9e9e"
}
]
},
{
"featureType": "transit.line",
Gramin Polytechnic Vishnupuri, Nanded. Page 65
Bus-Tracking 2023-2024
"elementType": "geometry",
"stylers": [
{
"color": "#e5e5e5"
}
]
},
{
"featureType": "transit.station",
"elementType": "geometry",
"stylers": [
{
"color": "#eeeeee"
}
]
},
{
"featureType": "water",
"elementType": "geometry",
"stylers": [
{
"color": "#c9c9c9"
}
]
},
{
"featureType": "water",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#9e9e9e"
}
]
}
]""";

Gramin Polytechnic Vishnupuri, Nanded. Page 66


Bus-Tracking 2023-2024
final String retro = """
[
{
"elementType": "geometry",
"stylers": [
{
"color": "#ebe3cd"
}
]
},
{
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#523735"
}
]
},
{
"elementType": "labels.text.stroke",
"stylers": [
{
"color": "#f5f1e6"
}
]
},
{
"featureType": "administrative",
"elementType": "geometry.stroke",
"stylers": [
{
"color": "#c9b2a6"
}
]
},
{
Gramin Polytechnic Vishnupuri, Nanded. Page 67
Bus-Tracking 2023-2024
"featureType": "administrative.land_parcel",
"elementType": "geometry.stroke",
"stylers": [
{
"color": "#dcd2be"
}
]
},
{
"featureType": "administrative.land_parcel",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#ae9e90"
}
]
},
{
"featureType": "landscape.natural",
"elementType": "geometry",
"stylers": [
{
"color": "#dfd2ae"
}
]
},
{
"featureType": "poi",
"elementType": "geometry",
"stylers": [
{
"color": "#dfd2ae"
}
]
},
{
Gramin Polytechnic Vishnupuri, Nanded. Page 68
Bus-Tracking 2023-2024
"featureType": "poi",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#93817c"
}
]
},
{
"featureType": "poi.park",
"elementType": "geometry.fill",
"stylers": [
{
"color": "#a5b076"
}
]
},
{
"featureType": "poi.park",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#447530"
}
]
},
{
"featureType": "road",
"elementType": "geometry",
"stylers": [
{
"color": "#f5f1e6"
}
]
},
{
Gramin Polytechnic Vishnupuri, Nanded. Page 69
Bus-Tracking 2023-2024
"featureType": "road.arterial",
"elementType": "geometry",
"stylers": [
{
"color": "#fdfcf8"
}
]
},
{
"featureType": "road.highway",
"elementType": "geometry",
"stylers": [
{
"color": "#f8c967"
}
]
},
{
"featureType": "road.highway",
"elementType": "geometry.stroke",
"stylers": [
{
"color": "#e9bc62"
}
]
},
{
"featureType": "road.highway.controlled_access",
"elementType": "geometry",
"stylers": [
{
"color": "#e98d58"
}
]
},
{
Gramin Polytechnic Vishnupuri, Nanded. Page 70
Bus-Tracking 2023-2024
"featureType": "road.highway.controlled_access",
"elementType": "geometry.stroke",
"stylers": [
{
"color": "#db8555"
}
]
},
{
"featureType": "road.local",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#806b63"
}
]
},
{
"featureType": "transit.line",
"elementType": "geometry",
"stylers": [
{
"color": "#dfd2ae"
}
]
},
{
"featureType": "transit.line",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#8f7d77"
}
]
},
{
Gramin Polytechnic Vishnupuri, Nanded. Page 71
Bus-Tracking 2023-2024
"featureType": "transit.line",
"elementType": "labels.text.stroke",
"stylers": [
{
"color": "#ebe3cd"
}
]
},
{
"featureType": "transit.station",
"elementType": "geometry",
"stylers": [
{
"color": "#dfd2ae"
}
]
},
{
"featureType": "water",
"elementType": "geometry.fill",
"stylers": [
{
"color": "#b9d3c2"
}
]
},
{
"featureType": "water",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#92998d"
}
]
}
]""";
Gramin Polytechnic Vishnupuri, Nanded. Page 72
Bus-Tracking 2023-2024

final String dark = """


[
{
"elementType": "geometry",
"stylers": [
{
"color": "#212121"
}
]
},
{
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#757575"
}
]
},
{
"elementType": "labels.text.stroke",
"stylers": [
{
"color": "#212121"
}
]
},
{
Gramin Polytechnic Vishnupuri, Nanded. Page 73
Bus-Tracking 2023-2024
"featureType": "administrative",
"elementType": "geometry",
"stylers": [
{
"color": "#757575"
}
]
},
{
"featureType": "administrative.country",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#9e9e9e"
}
]
},
{
"featureType": "administrative.land_parcel",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "administrative.locality",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#bdbdbd"
}
]
},
{
"featureType": "poi",
Gramin Polytechnic Vishnupuri, Nanded. Page 74
Bus-Tracking 2023-2024
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#757575"
}
]
},
{
"featureType": "poi.park",
"elementType": "geometry",
"stylers": [
{
"color": "#181818"
}
]
},
{
"featureType": "poi.park",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#616161"
}
]
},
{
"featureType": "poi.park",
"elementType": "labels.text.stroke",
"stylers": [
{
"color": "#1b1b1b"
}
]
},
{
"featureType": "road",
Gramin Polytechnic Vishnupuri, Nanded. Page 75
Bus-Tracking 2023-2024
"elementType": "geometry.fill",
"stylers": [
{
"color": "#2c2c2c"
}
]
},
{
"featureType": "road",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#8a8a8a"
}
]
},
{
"featureType": "road.arterial",
"elementType": "geometry",
"stylers": [
{
"color": "#373737"
}
]
},
{
"featureType": "road.highway",
"elementType": "geometry",
"stylers": [
{
"color": "#3c3c3c"
}
]
},
{
"featureType": "road.highway.controlled_access",
Gramin Polytechnic Vishnupuri, Nanded. Page 76
Bus-Tracking 2023-2024
"elementType": "geometry",

Home activicty

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:email_password_login/model/shared_preference.dart';
import 'package:email_password_login/model/user_model.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'login_screen.dart';

class HomeScreen extends StatefulWidget {


const HomeScreen({Key? key}) : super(key: key);

@override
_HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {


User? user = FirebaseAuth.instance.currentUser;
UserModel loggedInUser = UserModel();

PrefService _prefService = PrefService();

Future<bool?> _onBackPressed() async {


return showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('Do you want to exit?'),
actions: <Widget>[
TextButton(
child: Text('No'),
onPressed: () {
Navigator.of(context).pop(false);
},
),
TextButton(
child: Text('Yes'),
onPressed: () {

Gramin Polytechnic Vishnupuri, Nanded. Page 77


Bus-Tracking 2023-2024
Navigator.of(context).pop(true);
SystemNavigator.pop();
},
),
],
);
});
}

final Stream<QuerySnapshot>users=
FirebaseFirestore.instance.collection('users').snapshots();

@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
bool? result = await _onBackPressed();
if (result == null) {
result = false;
}
return result;
},
child: new Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: IconButton(
icon: Icon(
Icons.arrow_back,
color: Colors.black,
size: 30,
),
onPressed: () {
_onBackPressed();
},
),
),
body: Center(
child: Padding(
padding: EdgeInsets.all(20),
child: Column(

Gramin Polytechnic Vishnupuri, Nanded. Page 78


Bus-Tracking 2023-2024
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 150,
child: Image.asset("assets/images/logo.png",
fit: BoxFit.contain),
),
Text(
"Welcome Back",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.black),
),
SizedBox(
height: 10,
),
Container(
height:250,
padding:const EdgeInsets.symmetric(vertical:20),
child:StreamBuilder<QuerySnapshot>(
stream:users,
builder:(
BuildContext context,
AsyncSnapshot<QuerySnapshot>snapshot,){
if(snapshot.hasError){
return Text('Something went wrong.');
}
if(snapshot.connectionState == ConnectionState.waiting){
return Text('Loading');
}
final data=snapshot.requireData;

return ListView.builder(
itemCount:data.size,
itemBuilder:(context,index){
return Text('${data.docs[index]['fullname']}
${data.docs[index]['email']}');
}
);
}

Gramin Polytechnic Vishnupuri, Nanded. Page 79


Bus-Tracking 2023-2024
)
),
// Text("${loggedInUser.fullName}",
// style: TextStyle(
// color: Colors.black54,
// fontWeight: FontWeight.w500,
// )),
// Text("${loggedInUser.email}",
// style: TextStyle(
// color: Colors.black54,
// fontWeight: FontWeight.w500,
// )),
// SizedBox(
// height: 15,
// ),
ActionChip(
label: Text("Logout"),
onPressed: () async {
await _prefService
.removeCache("email", "password")
.whenComplete(() => {
logout(context),
});
}
),
],
),
),
)
)
);
}

// the logout function


Future<void> logout(BuildContext context) async {
await FirebaseAuth.instance.signOut();
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (context) => LoginScreen()));
}
}

Gramin Polytechnic Vishnupuri, Nanded. Page 80


Bus-Tracking 2023-2024

Gramin Polytechnic Vishnupuri, Nanded. Page 81


Bus-Tracking 2023-2024

Gramin Polytechnic Vishnupuri, Nanded. Page 82


Bus-Tracking 2023-2024

Gramin Polytechnic Vishnupuri, Nanded. Page 83


Bus-Tracking 2023-2024

Gramin Polytechnic Vishnupuri, Nanded. Page 84


Bus-Tracking 2023-2024
CHAPTER 6
TESTING & DEBUGGING STRATEGIES & TEST CASES
6.1 TESTING

Testing is the process of detecting errors. Testing performs a very critical role for quality
assurance and for ensuring the reliability of software. The results of testing are used later on during
maintenance also.

6.1.1 Psychology of Testing

The aim of testing is often to demonstrate that a program works by showing that it has no
errors. The basic purpose of testing phase is to detect the errors that may be present in the
program. Hence one should not start testing with the intent of showing that a program works, but
the intent should be to show that a program doesn’t work. Testing is the process of executing a
program with the intent of finding errors.

6.2 TESTING OBJECTIVES

The main objective of testing is to uncover a host of errors, systematically and with
minimum effort and time. Stating formally, we can say:

 Testing is a process of executing a program with the intent of finding an error.


 A successful test is one that uncovers an as yet undiscovered error.
 A good test case is one that has a high probability of finding error, if it exists.
 The tests are inadequate to detect possibly present errors.
 The software more or less confirms to the quality and reliable standards.

6.3 LEVELS OF TESTING

In order to uncover the errors present in different phases we have the concept of levels testing.
The basic levels of testing are as shown below…

 System Testing

Gramin Polytechnic Vishnupuri, Nanded. Page 85


Bus-Tracking 2023-2024

The philosophy behind testing is to find errors. Test cases are devised with this in mind. A
strategy employed for system testing is code testing.

 Code Testing:

This strategy examines the logic of the program. To follow this method we developed some
test data that resulted in executing every instruction in the program and module i.e. every path is
tested. Systems are not designed as entire nor are they tested as single systems. To ensure that the
coding is perfect two types of testing is performed or for that matter is performed or that matter is
performed or for that matter is performed on all systems.

6.4 TYPES OF TESTING

 Unit Testing
 Link Testing

6.4.1 Unit Testing

Unit testing focuses verification effort on the smallest unit of software i.e. the module.
Using the detailed design and the process specifications testing is done to uncover errors within
the boundary of the module. All modules must be successful in the unit test before the start of the
integration testing begins.

In this project each service can be thought of a module. There are so many modules like
Login, HWAdmin, MasterAdmin, Normal User, and PManager. Giving different sets of inputs has
tested each module. When developing the module as well as finishing the development so that each
module works without any error. The inputs are validated when accepting from the user.

In this application developer tests the programs up as system. Software units in a system
are the modules and routines that are assembled and integrated to form a specific function. Unit
testing is first done on modules, independent of one another to locate errors. This enables to detect
errors. Through this errors resulting from interaction between modules initially avoided.

Gramin Polytechnic Vishnupuri, Nanded. Page 86


Bus-Tracking 2023-2024

6.4.2 Link Testing


Link testing does not test software but rather the integration of each module in system. The
primary concern is the compatibility of each module. The Programmer tests where modules are
designed with different parameters, length, type etc.

6.4.3 Integration Testing


After the unit testing we have to perform integration testing. The goal here is to see if
modules can be integrated properly, the emphasis being on testing interfaces between modules.
This testing activity can be considered as testing the design and hence the emphasis on testing
module interactions.

In this project integrating all the modules forms the main system. When integrating all the
modules I have checked whether the integration effects working of any of the services by giving
different combinations of inputs with which the two services run perfectly before Integration.

6.4.4 System Testing

Here the entire software system is tested. The reference document for this process is the
requirements document, and the goal os to see if software meets its requirements.

Here entire ‘Bus tracking system’ has been tested against requirements of project and it is
checked whether all requirements of project have been satisfied or not.

6.4.5 Acceptance Testing


Acceptance Test is performed with realistic data of the client to demonstrate that the
software is working satisfactorily. Testing here is focused on external behavior of the system; the
internal logic of program is not emphasized.

In this project ‘Network Management Of Database System’ I have collected some data and
tested whether project is working correctly or not.

Test cases should be selected so that the largest number of attributes of an equivalence
class is exercised at once. The testing phase is an important part of software development. It is the
process of finding errors and missing operations and also a complete verification to determine
whether the objectives are met and the user requirements are satisfied.

Gramin Polytechnic Vishnupuri, Nanded. Page 87


Bus-Tracking 2023-2024

6.5 WHITE BOX TESTING

This is a unit testing method where a unit will be taken at a time and tested thoroughly at a
statement level to find the maximum possible errors. I tested step wise every piece of code, taking
care that every statement in the code is executed at least once. The white box testing is also called
Glass Box Testing.

I have generated a list of test cases, sample data. which is used to check all possible
combinations of execution paths through the code at every module level.

6.6 BLACK BOX TESTING

This testing method considers a module as a single unit and checks the unit at interface and
communication with other modules rather getting into details at statement level. Here the module
will be treated as a block box that will take some input and generate output. Output for a given set
of input combinations are forwarded to other modules.

6.7 TEST CASES

6.7.1 Test cases for Bus Tracking system

Test Case Test Case


ID Name Description Preconditions Test Steps Expected Result
Application
Check if passengers 1. Open the switches to
or crew members Application is application. <br> 2. Passenger mode
can successfully installed and Click on the and starts fetching
Verify entering enter the Passenger launched, GPS is "Passenger Mode" current location
BTTC_001 Passenger mode mode. enabled. button. data.
1. Wait for the
application to fetch
location data. <br>
Ensure that the 2. Compare the Fetched location
application fetches fetched location matches the actual
Verify fetching accurate current Application is in with the actual location within an
current location location data using Passenger mode, location using a acceptable margin
BTTC_002 data GPS. GPS is enabled. reliable GPS tool. of error.

Gramin Polytechnic Vishnupuri, Nanded. Page 88


Bus-Tracking 2023-2024
Test Case Test Case
ID Name Description Preconditions Test Steps Expected Result
Application
Check if the switches to Waiting
application can mode and displays
Verify switching switch to Waiting Application is in 1. Click on the the average
to Waiting mode from Passenger mode, "Switch to Waiting location of all users
BTTC_003 mode Passenger mode. multiple users. Mode" button. in Passenger mode.
Ensure that the
application Application is in Application
accurately calculates Waiting mode 1. Check if the displays the correct
Verify average the average location with multiple users application displays average location
location of all users in in Passenger the average location calculated from all
BTTC_004 calculation Passenger mode. mode. of all users. users' locations.
Check the accuracy
of the calculated Application is in 1. Calculate the The manually
average location by Waiting mode average location calculated average
Verify accuracy comparing it with with multiple users manually using location matches
of average individual users' in Passenger individual users' the one displayed
BTTC_005 location locations. mode. locations. by the application.
1. Click on the
Test how the "Passenger Mode" Application
application handles button. <br> 2. displays an error
Verify error the absence of GPS Observe error message indicating
handling for no signal when fetching message or the unavailability of
BTTC_006 GPS location data. GPS is disabled. behavior. GPS signal.
Test how the Application
application handles Application is in displays a message
Verify error the scenario when Waiting mode 1. Observe behavior indicating no users
handling for no no users are in with no users in when no users are are currently in
BTTC_007 users Passenger mode. Passenger mode. present. Passenger mode.
Ensure that the
application Location data
refreshes location Application is in updates at regular
data at regular Passenger mode 1. Monitor the intervals as per the
Verify data intervals for or Waiting mode frequency of specified refresh
BTTC_008 refresh interval accurate tracking. with active users. location updates. rate.
Check if the user
interface remains The UI remains
responsive and Application is 1. Interact with the responsive without
smooth during running with UI while location any lags or delays
location data active GPS and data is being during data
Verify UI fetching and processing fetched and fetching and
BTTC_009 responsiveness calculations. location data. processed. processing.

Gramin Polytechnic Vishnupuri, Nanded. Page 89


Bus-Tracking 2023-2024
Test Case Test Case
ID Name Description Preconditions Test Steps Expected Result
Test the
application's
compatibility and
functionality across Application is Application
different devices installed on 1. Open the functions correctly
Verify with varying screen multiple devices application on each and displays
compatibility sizes and with different device and perform properly on all
BTTC_010 across devices resolutions. specifications. tasks. tested devices.

Gramin Polytechnic Vishnupuri, Nanded. Page 90


Bus-Tracking 2023-2024

CHAPTER 7
ADVANTAGES

Improved Efficiency: By providing real-time location data of buses to passengers in waiting mode,
the application helps them plan their journeys more efficiently, reducing wait times and minimizing
disruptions.

Enhanced Safety: Passengers can track the current location of the bus, allowing them to make
informed decisions about their travel and ensuring their safety, especially during late hours or in
unfamiliar areas.

Optimized Routing: Utilizing GPS data and average location calculations from multiple users in
passenger mode, the application can optimize bus routes based on passenger demand, leading to more
efficient and cost-effective transportation services.

Reduced Congestion: With better route optimization and real-time tracking, the app can help reduce
congestion on roads by providing alternative routes or encouraging passengers to use less crowded
buses.

Improved User Experience: Passengers in waiting mode can have a more seamless and convenient
experience by accessing accurate location data and estimated arrival times, leading to higher
satisfaction levels with the transportation service.

Environmental Benefits: By optimizing routes and reducing congestion, the application contributes to
lowering carbon emissions and promoting environmentally sustainable transportation practices.

Cost Savings: Both passengers and transportation authorities can benefit from cost savings due to
improved route efficiency, reduced fuel consumption, and optimized resource allocation, leading to
overall financial savings for all stakeholders involved.

Gramin Polytechnic Vishnupuri, Nanded. Page 91


Bus-Tracking 2023-2024

CHAPTER 8

CONCLUSIONS & RECOMMENDATIONS

9.1 CONCLUSION

In conclusion, the bus tracking application offers a range of advantages that contribute to a more
efficient, safe, and user-friendly transportation experience. By providing real-time location data,
optimizing routes, and enhancing passenger convenience, the application improves the overall
efficiency of public transportation systems. Additionally, the app promotes environmental
sustainability, reduces congestion, and results in cost savings for both passengers and transportation
authorities. Overall, the bus tracking application represents a significant step forward in modernizing
and optimizing public transportation services for the benefit of passengers, operators, and the
community as a whole.

9.2 RECOMMENDATION ON FUTURE IMPROVEMENT

Recommendation on future improvement:

To further enhance the bus tracking application and maximize its benefits, the following recommendations are
suggested:

1. **Integration with Public Transport Networks**: Explore opportunities to integrate the application with
existing public transport networks, such as bus schedules, routes, and fare payment systems. This integration
would provide users with comprehensive information and streamline their journey planning process.

2. **Enhanced User Interface**: Continuously improve the user interface to make it more intuitive, visually
appealing, and accessible across different devices. Incorporate user feedback to identify areas for improvement
and implement user-centric design principles.

Gramin Polytechnic Vishnupuri, Nanded. Page 92


Bus-Tracking 2023-2024

3. **Advanced Analytics and Predictive Modeling**: Implement advanced analytics and predictive modeling
techniques to analyze historical data and predict future demand patterns. This information can be used to optimize
bus schedules, allocate resources efficiently, and anticipate passenger needs.

4. **Multilingual Support**: Introduce multilingual support to cater to a diverse user base and enhance
accessibility for non-native speakers. Provide options for users to switch between different languages based on
their preferences.

5. **Enhanced Security and Privacy Measures**: Strengthen security measures to safeguard sensitive user
data and ensure compliance with data protection regulations. Implement encryption techniques, secure
authentication methods, and regular security audits to mitigate potential risks.

6. **Integration with Smart City Initiatives**: Collaborate with local governments and smart city initiatives
to leverage emerging technologies, such as Internet of Things (IoT) sensors and urban mobility platforms. This
integration can facilitate seamless data sharing, interoperability, and alignment with broader urban development
goals.

7. **Continuous Performance Monitoring**: Establish mechanisms for continuous performance monitoring


and evaluation to assess the effectiveness of the application. Monitor key performance indicators (KPIs), such as
user engagement, reliability of location data, and impact on transportation efficiency, and iterate based on insights
gathered.

8. **Partnerships with Transportation Stakeholders**: Forge strategic partnerships with transportation


stakeholders, including bus operators, regulatory authorities, and technology providers. Collaborate on initiatives
to enhance infrastructure, standardize data formats, and promote interoperability within the transportation
ecosystem.

9. **Accessibility Features**: Incorporate accessibility features, such as voice-guided navigation, screen reader
compatibility, and alternative input methods, to ensure inclusivity for users with disabilities or special needs.

By implementing these recommendations, the bus tracking application can evolve into a comprehensive and
indispensable tool for improving public transportation services, enhancing passenger experiences, and
contributing to the development of smarter, more sustainable cities.

Gramin Polytechnic Vishnupuri, Nanded. Page 93


Bus-Tracking 2023-2024

CHAPTER 9

REFERENCE
1. Websites:-
1. www.androidtutorials.com
2. www.progchamp.com
3. https://www.emarketinginstitute.org/
4. https://www.restolabs.com/

2. Books:-

1. Hello, Android by Ed Burnette.

2. Android Programming for Beginners by John Horton.

Gramin Polytechnic Vishnupuri, Nanded. Page 94

You might also like