You are on page 1of 19

KARNATAK LAW SOCIETY’S

GOGTE INSTITUTE OF TECHNOLOGY


UDYAMBAG, BELAGAVI-590008

(An Autonomous Institution under Visvesvaraya Technological University, Belagavi)


(APPROVED BY AICTE, NEW DELHI)

Course Activity Report

TRACK MY FRIEND APP

Submitted in the partial fulfillment for the academic requirement of

7th Semester B.E.

in

Mobile Application Development Laboratory

Submitted by
NAME USN

CHIDAMBAR INAMDAR 2GI19CS035

DEEPAK N KUMBLE 2GI19CS038

GOURAV SHANBAGH 2GI19CS046

IRFAN KAMATE 2GI19CS052

GUIDE

Prof. Ravi U. Kalkundri


Assistant Professor
2022 – 2023
GOGTE INSTITUTE OF TECHNOLOGY
UDYAMBAG, BELAGAVI-590008

(An Autonomous Institution under Visvesvaraya Technological University, Belagavi)


(APPROVED BY AICTE, NEW DELHI)

Department of Computer Science and Engineering

CERTIFICATE
This is to certify that the students Chidambar Inamdar, Deepak N Kumble, Gourav
Shanbhag, Irfan Kamate of 7th semester bearing USN’s 2GI19CS035, 2GI19CS038,
2GI19CS046, 2GI19CS052 have satisfactorily completed the course activity (Project) in
Mobile Application Development course (Course code: 18CSL78). It can be considered as
a bonafide work carried out in partial fulfillment for the academic requirement of 7th
Semester B.E prescribed by KLS Gogte Institute of Technology, Belagavi during the
academic year 2022- 2023.
The report has been approved as it satisfies the academic requirements in respect of
Assignment (Course project) prescribed for the said Degree.

Signature of the Faculty Member        Signature of the HOD

Date: 02-01-2023

1|Page
Marks allocation

Batch No.:

1. Project Title: Marks


Track my Friend app Range

2. Abstract (PO2) 0-2

3. Application of the topic to the course (PO2) 0-3

4. Literature survey and its findings (PO2) 0-4

5. Methodology, Results and Conclusion


0-6
(PO1, PO3, PO4)

6. Report and Oral presentation skill (PO9, PO10) 0-5

Total 20

* 20 marks is converted to 10 marks for CGPA calculation

1. Engineering Knowledge: Apply the knowledge of mathematics, science, engineering


fundamentals and an engineering specialization to the solution of complex engineering
problems.
2. Problem Analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of mathematics,
natural sciences and Engineering sciences. 3.Design/Development of solutions: Design solutions
for complex engineering problems and design system components or processes that meet the
specified needs with appropriate consideration for the public health and safety, and the cultural,
societal, and environmental considerations.
4. Conduct investigations of complex problems: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and synthesis of
the information to provide valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities with
an understanding of the limitations. 6.The engineer and society: Apply reasoning informed by the
contextual knowledge to assess societal, health, safety, legal and cultural issues and the consequent
responsibilities relevant to the professional engineering practice.
7. Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need
for sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and
norms of the engineering practice.
9. Individual and team work: Function effectively as an individual and as a member or leader in
diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write
effective reports
11. Project management and finance: Demonstrate knowledge and understanding of the
engineering management principles and apply these to one's own work, as a member and leader
in a team, to manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for and have the preparation and ability to engage
in independent and lifelong learning in the broadest context of technological channel

2|Page
TRACK MY FRIEND APP

PROBLEM STATEMENT
There might be a time when someone wants to get the location of their friends. The
result could be losing a chance to hang out and catch up with colleague or missing out
on meeting someone dear that they will probably never be able to see again. Either
way, it is unfortunate not being able to have a mobile service that can prevent such
circumstances when most mobile phones are equipped with a Geographical
Positioning System (GPS) and tools to define and manage users' connections.
Thus, develop an app to show your friends location.

INTRODUCTION
Mobile phones have become a major part of our daily lives. The importance of them is since
they are an easy way of communication, Internet access and social media. They also save
money, ensure safety, help in business and many more.

Mobile phones can support a wide range of applications, giving them many of the same
functions available on a laptop but without the extra bulk.

Anyone who has a smart phone or another mobile device probably uses apps to play games,
get directions, access news, books, weather, and so on. Mobile apps are easy to download, are
often free and are convenient such that sometimes users might download them without
thinking about some key considerations: how they are paid for, what information they may
gather from the device, or who gets that information.

There is a need to continue to develop new apps that serve the growing demands of mobile
users. The market of mobile apps makes use of new mobile and hardware technologies, and
therefor expands with the expansion of these technologies.

During the past few decades, advancements in technology have been exceptionally fast,
especially in computer and mobile technologies. This fast improvement resulted in a need to
develop applications and services that enhance human lives.

Global Positioning System (GPS) is the technique that is used to determine the position of
objects on the Earth surface. This technique has become widely used in many desktop and
mobile applications.

In this project, we developed FriendTracker, which is a mobile application that tracks/locates


them from their recent location using their GPS. The user can check their friends location by
tapping in their friends list.

3|Page
FUNCTIONAL BLOCK DIAGRAM

4|Page
WORKING MODEL

Login Page:

Contents:

5|Page
Location Update:

Friend’s Location:

6|Page
WORKING CODE

Login:
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:friendtracker/LoginPage.dart';
import 'package:friendtracker/mainPage.dart';
Future main() async{
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MaterialApp(home:Signin()));
}
class Signin extends StatefulWidget {
const Signin({Key? key}) : super(key: key);
@override
State<Signin> createState() => _SigninState();
}
class _SigninState extends State<Signin> {
final controllername = new TextEditingController();
final controllerphoneno = new TextEditingController();
double deviceHeight(BuildContext context) => MediaQuery.of(context).size.height;
double deviceWidth(BuildContext context) => MediaQuery.of(context).size.width;
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Friend Locator'),
centerTitle: true,
),
body: Form(
key: _formKey,
child: Center(
child: Column(
children: [
SizedBox(height: 40,),
Text('Signin Page',style: TextStyle(
fontSize: 30,
),),
SizedBox(
height: 30,
),

7|Page
SizedBox(
child: TextFormField(
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter some text';
}
return null;
},
controller: controllerphoneno,
decoration: InputDecoration(
labelText: 'Phone Number',
border: OutlineInputBorder(),
),
style: TextStyle(
fontSize: 20,
),
),
width: 350,
),
SizedBox(
height: 20,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(child: ElevatedButton(onPressed: () async{
final phoneno = controllerphoneno.text;
bool exist = false;
if (_formKey.currentState!.validate()) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Processing Data')),
);
try{
await
FirebaseFirestore.instance.doc("Coordinates/$phoneno").get().then((doc){
exist = doc.exists;
});
}
catch(e){
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Firebase document check failed')),
);
}

8|Page
if(exist == true){
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder:
(context)=>Home(userid: phoneno,)),(context)=>false);
}
else{
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('User id Not found, Try once again')),
);
}
}
},
child: Text('Signin',style: TextStyle(
fontSize: 20,
),)
),
width: 150,
),
SizedBox(child: ElevatedButton(onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context)=>Login()));
},
child: Text('Signup',style: TextStyle(
fontSize: 20,
),)
),
width: 130,
),
],
)
],
),
);
}
}

SignIn page:
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:friendtracker/mainPage.dart';
Future main() async{
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MaterialApp(home:Login()));

9|Page
}
class Login extends StatefulWidget {
const Login({Key? key}) : super(key: key);
@override
State<Login> createState() => _LoginState();
}
class _LoginState extends State<Login> {
final controllername = new TextEditingController();
final controllerphoneno = new TextEditingController();
Future createUser({required String name,required String phoneNo}) async{
final docUser = FirebaseFirestore.instance.collection('Coordinates').doc(phoneNo);
final user = User(
name: name,
lat: '0.0',
long: '0.0',
phno: phoneNo,
);
final json = user.toJson();
await docUser.set(json);
}
double deviceHeight(BuildContext context) => MediaQuery.of(context).size.height;
double deviceWidth(BuildContext context) => MediaQuery.of(context).size.width;
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Friend Locator'),
centerTitle: true,
),
body: Form(
key: _formKey,
child: Center(
child: Column(
children: [
SizedBox(height: 40,),
Text('Signup Page',style: TextStyle(
fontSize: 30,
),),
SizedBox(
height: 30,
),
SizedBox(
child: TextFormField(

10 | P a g e
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter some text';
}
return null;
},
controller: controllername,
decoration: InputDecoration(
labelText: 'Name',
border: OutlineInputBorder(),
),
style: TextStyle(
fontSize: 20,
),
),
width: 350,
),
SizedBox(
height: 20,
),
SizedBox(
child: TextFormField(
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter some text';
}
return null;
},
controller: controllerphoneno,
decoration: InputDecoration(
labelText: 'Phone Number',
border: OutlineInputBorder(),
),
style: TextStyle(
fontSize: 20,
),
),
width: 350,
),
SizedBox(
height: 20,
),
SizedBox(child: ElevatedButton(onPressed: (){
if (_formKey.currentState!.validate()) {

11 | P a g e
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Processing Data')),
);
final name = controllername.text;
final phoneNo = controllerphoneno.text;
createUser(name: name, phoneNo: phoneNo);
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder:
(context)=>Home(userid: phoneNo),), (route) => false);
}
},
child: Text('Login',style: TextStyle(
fontSize: 20,
),)
),
width: 150,
),
],
),
);
}
}
class User{
final String lat;
final String long;
final String name;
final String phno;
User({
required this.name,
required this.lat,
required this.long,
required this.phno,
});
Map<String ,dynamic> toJson() =>{
'name': name,
'lat' : lat,
'long' : long,
'phno' : phno,
};
}

Location Update Page:


import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';

12 | P a g e
import 'package:firebase_core/firebase_core.dart';
import 'package:geolocator/geolocator.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:friendtracker/friendList.dart';
Future main() async{
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MaterialApp(home:Home(userid: '')));
}
class Home extends StatefulWidget {
final String userid;
const Home({Key? key,required this.userid}) : super(key: key);
@override
State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> {
String locationMessage = 'Current Location of the User';
late String lat;
late String long;
Future<Position> _getCurrentLocation() async{
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
if(!serviceEnabled){
return Future.error('Location services are disabled');
}
LocationPermission permission = await Geolocator.checkPermission();
if(permission == LocationPermission.denied){
permission = await Geolocator.requestPermission();
if(permission == LocationPermission.denied){
return Future.error('Location permission are denied');
}
}
if(permission == LocationPermission.deniedForever){
return Future.error('Location Permission are permanently denied, we cannot request the
location');
}
return Geolocator.getCurrentPosition(
desiredAccuracy: LocationAccuracy.high
);
}
void _liveLocation(){
LocationSettings locationSettings = const LocationSettings(
accuracy: LocationAccuracy.high,
distanceFilter: 100,
);

13 | P a g e
Geolocator.getPositionStream(locationSettings: locationSettings).listen((Position position)
{
lat = position.latitude.toString();
long = position.longitude.toString();
});
}
Future<void> _openMap(String lat, String long) async{
String googleURL= 'https://www.google.com/maps/search/?api=1&query=$lat,$long';
await canLaunch(googleURL)
? await launch(googleURL)
: throw 'could not launch $googleURL';
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Friend Locator'),
centerTitle: true,
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(locationMessage,textAlign: TextAlign.center,),
const SizedBox(height: 20,),
const SizedBox(height: 20,),
ElevatedButton(onPressed: (){
_getCurrentLocation().then((value) {
lat = '${value.latitude}';
long = '${value.longitude}';
final lat1 = lat;
final long1 = long;
final docUser =
FirebaseFirestore.instance.collection('Coordinates').doc(widget.userid);
docUser.update({
'lat' : lat1,
'long' : long1,
});
print(lat);
print(long);
_liveLocation();
});
}, child: const Text('Update my Current Location')),
const SizedBox(height:20),

14 | P a g e
ElevatedButton(onPressed: (){
_openMap(lat, long);
}, child: const Text('Show my location')),
SizedBox(height: 20,),
ElevatedButton(onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context)=>friendList()));
}, child: Text('Friends List'))
],
)
);
}
}
class User{
final String lat;
final String long;
final String name;
final String phno;
User({
required this.name,
required this.lat,
required this.long,
required this.phno,
});
Map<String ,dynamic> toJson() =>{
'name': name,
'lat' : lat,
'long' : long,
'phno' : phno,
};
}

Friend Location Page:


import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:geolocator/geolocator.dart';
import 'package:url_launcher/url_launcher.dart';
Future main() async{
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MaterialApp(
home:friendList()
));

15 | P a g e
}
class friendList extends StatefulWidget {
const friendList({Key? key}) : super(key: key);

@override
State<friendList> createState() => _friendListState();
}
class _friendListState extends State<friendList> {
late String lat;
late String long;
Stream<List<User>> readUsers() => FirebaseFirestore.instance.collection('Coordinates')
.snapshots()
.map((snapshot) =>
snapshot.docs.map((doc)=> User.fromJson(doc.data())).toList());
Widget buildUser(User user)=> Material(
child: ListTile(
leading: CircleAvatar(child: Text('${user.name[0]}'),),
title: Text(user.name.toString(),style: TextStyle(
fontSize: 18,
),),
subtitle: Text(user.phno),
onTap: () async{
String googleURL= 'https://www.google.com/maps/search/?api=1&query=${user.lat},$
{user.long}';
await canLaunch(googleURL)
? await launch(googleURL)
: throw 'could not launch $googleURL';
},
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0),
side: BorderSide(
color: Colors.black26,
)),
),
elevation: 2.0,
);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title:Text('Friend Locator'),
centerTitle: true,
),
body: StreamBuilder<List<User>>(
stream: readUsers(),

16 | P a g e
builder: (context,snapshot){
if(snapshot.hasData){
final users = snapshot.data!;
return ListView(
children: users.map(buildUser).toList(),

);
}
else if(snapshot.hasError){
return Text('Something went wrong! ${snapshot.error}');
}
else{
return Center(child: CircularProgressIndicator(),);
}
}
),
);
}
}
class User{
final String lat;
final String long;
final String name;
final String phno;
User({
required this.name,
required this.lat,
required this.long,
required this.phno,
});
Map<String ,dynamic> toJson() =>{
'name': name,
'lat' : lat,
'long' : long,
'phno' : phno,
};
static User fromJson(Map<String , dynamic> json) => User(
name: json['name'],
lat: json['lat'],
long: json['long'],
phno: json['phno'],
);
}
CONCLUSION
17 | P a g e
In this project, a mobile application has been developed, FriendTracker, which:

1. SignUp/SignIn to use the application.


2. Update own location.
3. Allows adding friends to the list.
4. Display location of their friend.
5. Display maps.

REFERENCES
 https://spaceplace.nasa.gov/gps/en/
 https://www8.garmin.com/aboutGPS/
 https://en.wikipedia.org/wiki/Find_My_Friends
 https://www.lucidchart.com

18 | P a g e

You might also like