44
Plan Your Way ( An Android Application ) Undertaken by: Muhammad Noman REG NO.CIIT/FA10-BS(CS)-059/Wah DEPARTMENT OF COMPUTER SCIENCES COMSATS INSTITUTE OF INFORMATION TECHNOLOGY WAH CANTT – PAKISTAN SESSION 2010-2014

Final FYP Report

Embed Size (px)

Citation preview

Page 1: Final FYP Report

Plan Your Way

( An Android Application )

Undertaken by:

Muhammad Noman REG NO.CIIT/FA10-BS(CS)-059/Wah

DEPARTMENT OF COMPUTER SCIENCES

COMSATS INSTITUTE OF INFORMATION TECHNOLOGY

WAH CANTT – PAKISTAN

SESSION 2010-2014

Page 2: Final FYP Report

Plan Your Way

( An Android Application )

Undertaken by:

Muhammad Noman REG NO.CIIT/FA10-BS(CS)-059/Wah

Supervised by:

Mr. Riaz Ahmed Bhatti

A DISSERTATION SUBMITTED AS A PARTIAL FULFILLMENT OF THE

REQUIREMENTS FOR THE DEGREE OF BACHELOR IN COMPUTER SCIENCE

DEPARTMENT OF COMPUTER SCIENCES COMSATS INSTITUTE OF INFORMATION TECHNOLOGY,

WAH CANTT – PAKISTAN

SESSION 2010-2014

Page 3: Final FYP Report

FINAL APPROVAL

Certified that we have read this project report submitted by Mr.

Muhammad Noman and it is, in our judgment, of sufficient standard to

warrant its acceptance by COMSATS Institute of Information

Technology, Wah Cantt, for the award of Bachelor degree in Computer

Science.

Committee:

1. External Examiner ___________________

Dr. Saad Rehman

Assistant Professor

E&ME College, Rawalpindi

2. Supervisor ___________________

Mr. Riaz Ahmed

3. Head of Department ___________________

Dr. Ehsan Ullah Munir

Page 4: Final FYP Report

DEDICATION

To my loving and respected parents, teachers, and all those friends who were there

to help me in my project making

Page 5: Final FYP Report

ACKNOWLEDEGMENT

In the name of Almighty Allah, the Most Kind and Most Merciful, without His

blessings it cannot be possible for me to complete my project “Plan Your Way”.

My success is the result of the technical guidelines, invaluable Comments and

moral support of my supervisor and for that i would like to thank my project

supervisor, Mr. Riaz Ahmed Bhatti, for keep tracking of project progress and

supporting throughout the project and having his trust in my ability to successfully

deliver it.

I would like to further extend my thanks to the whole teaching unit of the faculty

of Computer Science and project committee for their patience and all the guidance

and advises provided during the project progress.

I would like to thanks my parents and all other family members and friends who

kept backing me up in all the times, both monetarily and morally.

Muhammad Noman

Page 6: Final FYP Report

PROJECT BRIEF

PROJECT NAME PLAN YOUR WAY

(ANDROID APPLICATION)

OBJECTIVE CREATING LOCATION

AWARENESS WITH EASY TO

USE APPLICATION OF SMART

PHONE

UNDERTAKEN BY MUHAMMAD NOMAN

SUPERVISED BY MR. RIAZ AHMED BHATTI

ASST. PROFESSOR

DEPARTMENT OF COMPUTER

SCIENCE

COMSATS WAH CANTT.

STARTED ON

COMPLETED ON

COMPUTER USED INTEL CORE i3

Page 7: Final FYP Report

SOURCE LANGUAGE JAVA FOR ANDROID OS AND

XML (EXTENDED MARKUP

LANGUAGE)

JSON (Java Script Object Notation)

OPERATING SYSTEM WINDOWS 7 FOR PC

ANDROID (4.1.2) FOR MOBILE

TOOLS USED ECLIPSE ADT (ANDROID

DEVELOPMENT KIT)

Page 8: Final FYP Report

ABSTRACT

“Plan your way” is an application for Smart Mobile devices operates on Android

operating system. Which provides Location based services; using android GPS, the

application is location aware. It keeps track of the user location in real time this

application will be able to find and present the shortest path between different

possible paths from current location to specified location.

Basically this application will be used for minimizing the cost of time and fuel

further it provides guidance to unknown person going to their destination. This

Application is able to highlights important places like Hotels, Hospitals, Picnic

spots and most importantly fuel stations. Weather forecasting is another feature in

this Application which keeps you informs what to wear at destination place. A

special feature for Muslim community is added in this Application which is

“locating the Kiblah direction” to offering their prayer in right direction, which is

normally misjudged at unknown places.

Page 9: Final FYP Report

This page is intentionally left blank

Page 10: Final FYP Report

i

TABLE OF CONTENTS

Plan Your Way

( An Android Application )

Chapter 1 ....................................................................................................................................... 1

Introduction ................................................................................................................................... 2

1.1 Problem Statement............................................................................................................. 2

1.2 Objectives of the project .................................................................................................... 3

1.3 Features and functionality of the proposed system ........................................................ 3

1.4 Possible areas of application: ............................................................................................ 4

1.5 Hardware Requirement..................................................................................................... 4

1.6 Interface Requirement....................................................................................................... 4

1.6.1 Operating System ......................................................................................................... 4

1.6.2 Programming Language ............................................................................................... 4

1.6.3 Environment ................................................................................................................. 4

1.6.4 GUI ............................................................................................................................... 4

1.6.5 Other Tools ................................................................................................................... 5

1.6.6 APIs .............................................................................................................................. 5

1.6.7 Android Version ........................................................................................................... 5

1.7 Technology to be used ........................................................................................................ 5

Chapter 2 ....................................................................................................................................... 6

Background ................................................................................................................................... 6

2.1 Android Operating System ............................................................................................... 7

2.2 Why Android? .................................................................................................................... 7

Open Platform/ Manufacturer independent ......................................................................... 7

Three-tire Structure .............................................................................................................. 7

Rapid improvement .............................................................................................................. 8

Development Language options .......................................................................................... 8

Page 11: Final FYP Report

ii

License Free ......................................................................................................................... 8

Ease in Application Development ....................................................................................... 8

Popularity ............................................................................................................................. 8

2.3 Challenges for Android ..................................................................................................... 9

Hard to Integrate for Vendors .............................................................................................. 9

Performance Consideration .................................................................................................. 9

Too Much Google Dependent .............................................................................................. 9

2.4 Limitations and constraints: ............................................................................................. 9

Internet ............................................................................................................................... 10

Weather .............................................................................................................................. 10

Vehicles.............................................................................................................................. 10

2.5 Android in Future: ........................................................................................................... 10

Chapter 3 ..................................................................................................................................... 11

Features and Design .................................................................................................................... 11

3.1 Features and Design Description .................................................................................... 12

3.1.1 Find shortest path to destination. ................................................................................ 12

3.1.2 Highlight Places of interest ......................................................................................... 13

3.1.3 Compass for kiblah direction. ..................................................................................... 14

3.1.4 Maintaining History .................................................................................................... 14

Chapter 4 ..................................................................................................................................... 15

Components and Architecture ................................................................................................... 15

4.1 Basic Architecture ............................................................................................................ 16

4.2 Hardware & Other Components .................................................................................... 17

4.3 Google Data Base and API`s ........................................................................................... 18

4.3.1 Map API ..................................................................................................................... 18

4.3.2 Places and Direction API ............................................................................................ 18

Chapter 5 ..................................................................................................................................... 19

Methodology ................................................................................................................................ 19

5.1 Data Flow .......................................................................................................................... 20

5.2 JSON (Java Script Object Notation) .............................................................................. 20

5.3 Geo Coding and Reverse Geo Coding ............................................................................ 21

Page 12: Final FYP Report

iii

5.4 Interface and Information Exchange ............................................................................. 21

5.5 Data Base File Handling and API`s ................................................................................ 21

Chapter 6 ..................................................................................................................................... 23

Implementation ........................................................................................................................... 23

6.1 Using the On-Device GPS ................................................................................................ 24

6.2 Calculating Distance between Two Points ..................................................................... 24

6.3 Finding the interested places........................................................................................... 25

6.4 Finding the Qibla direction ............................................................................................. 26

Chapter 7 ..................................................................................................................................... 27

Results .......................................................................................................................................... 27

Warnings for Internet Connection ...................................................................................... 28

Main Menu .......................................................................................................................... 28

Get Direction Activities ...................................................................................................... 28

When Universities is selected from drop down menu ........................................................ 29

Interested Places Activities ................................................................................................. 29

When Hospital is selected from drop down menu .............................................................. 30

Qibla Direction Activity ..................................................................................................... 30

References .................................................................................................................................... 31

Web sites ............................................................................................................................. 32

Books .................................................................................................................................. 32

Papers .................................................................................................................................. 32

Page 13: Final FYP Report

Chapter 1

Introduction

Page 14: Final FYP Report

Introduction

Plan Your Way [An Android Application] 2

Introduction

“Plan your way” is an application for Smart Mobile devices operates on Android operating

system. Which provides Location based services; using android GPS, the application is location

aware. It keeps track of the user location in real time this application will be able to find and

present the shortest path between different possible paths from current location to specified

location. Basically it can be used for minimizing the cost of time and fuel further it provides

guidance to unknown person going to their destination. Th1is Application is able to highlights

important places like Hotels, Hospitals, Picnic spots and most importantly fuel stations. Weather

forecasting is another feature in this Application which keeps you informs what to wear at

destination place. A special feature for Muslim community is added in this Application which is

“locating the Kiblah direction” to offering their prayer in right direction, which is normally

misjudged at unknown places.

1. This project can be used for Guidance purpose which will guide you about your

destination by finding the shortest path, keeps you inform about places of interest

between the paths.

2. Energy Efficient; This Application leads you to the right way with minimum time and

cost.

3. Tourism; for planning trips and tours.

4. Self-tracking when you get lost at unknown place.

1.1 Problem Statement

The following problem statement briefly defines the boundaries and environment of this project:

An android application, which has the capability of location awareness, collects the

virtual information of user’s surroundings, by detecting and tracking user’s location in real time.

Page 15: Final FYP Report

Introduction

Plan Your Way [An Android Application] 3

Using the GPS the application is fully location aware which keeps the track of user's location.

When the user move towards specific location, the application tracks the movement and displays

the current location. Then the application keeps on updating the information as the place

changes. According to user query it displays the shortest path to destination or displays important

places near to the current location like Hospital, Universities, Shops, Fuel Stations.., etc. The

additional information is displayed with the help of "Google" databases which helps the users to

interact in a more reliable way. Option for viewing the places in normal Google Map view as

well as Satellite View is also available.

1.2 Objectives of the project

Main objectives are:-

Primary objectives:

a) Find shortest Driving path to destination.

b) Highlight Places of interest like Picnic spots, Popular Hotels and Fuel stations etc.

(Provided with Option for viewing places in Satellite View as well as Normal Google Map

View)

Secondary Objectives:

a) Maintaining the history of user activity.

b) Compass for kiblah direction.

c) Weather forecast of Destination place.

1.3 Features and functionality of the proposed system

The proposed system requires smart device, a mobile phone with GPS Technology. Basic

architecture of the system is that a mobile phone having internet connectivity with Wi-Fi or

GPRS. On launching the application mobile get the co-ordinates of current location using build

in GPS device or from internet, which is used for finding the path to destination (destination co-

ordinates are input to the system). For other feature of Application some queries are required

which are executed according to user input.

Page 16: Final FYP Report

Introduction

Plan Your Way [An Android Application] 4

1.4 Possible areas of application:

This project can be used for Guidance purpose which will guide you about your

destination by finding the shortest path, keeps you inform about weather and places

of interest between the paths.

Energy Efficient; This Application leads you to the right way with minimum time

and cost.

Tourism; for planning trips and tours.

Self-tracking when you get lost at unknown place.

1.5 Hardware Requirement

A PC (Personal Computer) having Windows 7 Operating System

Mobile phone having Android Operating System with GPS Technology

Emulator (Virtual Mobile Phone)

1.6 Interface Requirement

1.6.1 Operating System

The platform used for development of this project is Windows 7 Operating

system.

1.6.2 Programming Language

Java and XML is used as a development language.

1.6.3 Environment

Eclipse (v22.0.5-757759)

1.6.4 GUI

The GUI (Graphical User Interface) is designed in eclipse using XML

Page 17: Final FYP Report

Introduction

Plan Your Way [An Android Application] 5

1.6.5 Other Tools

Java JDK (Java Development Kit)

Android SDK (Software Development Kit)

Etc.

1.6.6 APIs

Google Maps API, Places API, Direction API, has also been used in the

development of this application

1.6.7 Android Version

Minimum requirement for android version of this application is v. 2.3.4.

Target version is 4.1.2 Jelly Bean.

1.7 Technology to be used

i. ADT Bundle (Android Development Toolkit)

ii. Android SDK

iii. API`s ( Google Map API, Location API, Direction API)

iv. Smartphone with Wi-Fi and GPS Device

v. Google Online Database

Page 18: Final FYP Report

Chapter 2

Background

Page 19: Final FYP Report

Background

Plan Your Way [An Android Application] 7

2.1 Android Operating System

There is a lot of advancement in the OS (Operating Systems) since the last few decades. When

we look at the early stages of the cell phones, the black and white phones were came into focus

but with the passage of time, cell phones were pushed onto the next level and now smart phones

are particularly in focus. Mobile OS has come into horizon. In past Symbian and Java Operating

System were used for Mobile devices but a revolution came in mobile industry. The operating

systems for smart phones & tablets, there was a need of change, so after the year 2000 the OS

like Android and Blackberry were urbanized (came into existence).

With the passage of time, among all the greatest and widely used mobile operating systems there

was android. Android Inc. was founded in Palo Alto of California, U.S. by Andy Rubin, Rich

miner, and Chris White in early 2000. Then later on in 2005 Android was picked up by Google.

With the advancement in Android OS, numerous versions were introduced. After that there have

been number of updates are still coming in order to satisfy the user need perfectly. Android

Operating System gives the flexibility for both (users & developers).

2.2 Why Android?

The Key reasons that forced us to choose Android were:

Open Platform/ Manufacturer independent

Android is not constraint to any maker, so it allows us to develop and change the

existence of original and makes us more innovative in the development process.

Three-tire Structure

For development it follows Three-tier structure which gives freedom to developers to

program dynamically. XML separates the user interface from actual data and other Java

Page 20: Final FYP Report

Background

Plan Your Way [An Android Application] 8

coding for function execution. So data interface and business logic remain separate which

is very important for dynamic programing or when requirement changed accordingly.

Rapid improvement

As the developer of Android, we have the opportunity to take the advancement to the

next level. Advancement can be in any form like the OLED display in the Android cell

phones.

Development Language options

Many mobile applications can be developed in any language like JAVA, Perl etc.

Android provides the options to interact with different languages for more productive

development. Such as: XML, JAVA and other Libraries for particular functions.

License Free

The license expenses does matter a lot, which is not noticeable in the Android

development because of its free sourcing advantage.

Ease in Application Development

Error checking and Debugging become more efficient and easy to handle. The emulator

plays an important role in the testing process of any application made for android with

the help of Android SDK (Software Development Kit).

Popularity

With more advancement in android, it has become the most popular OS of all times as

compared to others.

Page 21: Final FYP Report

Background

Plan Your Way [An Android Application] 9

2.3 Challenges for Android

Hard to Integrate for Vendors

When talking about the IOS, the developers have to deal with fewer complications in the

developing process because of the fewer versions. The same is not the case with Android

applications. There are different brands in the market offering different screen sizes and

using various kinds of processors. So this makes a great deal of opportunity for the

android developers to innovate something new which can be nearly compared to as a

difficult task.

Performance Consideration

Every device has its own way of handling itself. Different brands, offering different

devices with various screen sizes and using various kinds of processors results in

performance issues.

Too Much Google Dependent

When talking about android, we automatically came to know that it is a lot in the handled

by Google. Google makes Android a bit more terms independent which makes it much

better.

2.4 Limitations and constraints:

Since satellite transmission power is low, certain geographical conditions may cause problems

with a GPS receiver’s ability to record location data.

Page 22: Final FYP Report

Background

Plan Your Way [An Android Application] 10

Internet

This Application heavily depends on Internet connection. This Application fails to work

if connection is not available.

Weather Signal strength can become degraded by moisture such as rainfall, fog, or snowfall.

Vehicles Signals can be lost when any person is riding in a car or other enclosed means of

Transportation if the receiver is not placed near a window within the vehicle.

2.5 Android in Future:

The future years are going to introduce Android to a greater level. The developed applications in

Android are well known by the Android users. In imminent, developers will be in a big problem

in deciding their launch of first applications. The growing Android base is absolutely a positive

factor. In other words, the Android Application Developers cannot fail to notice the positive

response that they can earn with Android based Smartphone.

Page 23: Final FYP Report

Chapter 3

Features and Design

Page 24: Final FYP Report

Features and Design

Plan Your Way [An Android Application] 12

Main Menu

3.1 Features and Design Description

This Application provides Location based services; this

application will be able to find and mark the complete path from

current location to specified location. This Application uses

Google API for Displaying Maps. Due to Android GPS, the

application is location aware. This application facilitates those

people who move from one place to another (some time to

unknown place) which is used for Route guidance and location

awareness.

Basically it can be used for minimizing the cost of time and fuel

further it provides guidance to unknown person going to their

destination. This Application is able to highlights important

places like Hotels, Hospitals, Picnic spots and most importantly

fuel stations. Weather forecasting is another feature in this

Application which keeps you informs what to wear at destination

place. A special feature for Muslim community is added in this

Application which is “locating the Kiblah direction” to offering

their prayer in right direction, which is normally misjudged at

unknown places.

3.1.1 Find shortest path to destination.

Get Direction button in main menu is served to start

GetDirection.java activity. Current location is

automatically captured through GPS device present in

smart phone by putting a marker on Map. Destination place

is inputted to the system using Edit Text box. By pressing

the Get Route Button on Get Direction Activity, a complete

shortest path is displayed on Google Map and prompts the

total distance from current location to destination. Map

View can be changed to Satellite view as well as Normal

Page 25: Final FYP Report

Features and Design

Plan Your Way [An Android Application] 13

View for better interaction of user with locations.

3.1.2 Highlight Places of interest

Interested Places button in main menu is served to start

Interested Places.java activity. It displays a list of

important places like: Hospitals, Universities, picnic

spots, Hotels and Restaurants, etc. if any one of those

particular places is selected then all location of that

particular place is presented on Map with markers.

Further details about specific locationis displayed if

user click/tap on particular marker and Information

Window.

Page 26: Final FYP Report

Features and Design

Plan Your Way [An Android Application] 14

3.1.3 Compass for kiblah direction.

Qibla Direction button in main menu is served to start

Qibla Direction.java activity. It gets the current

coordinate and calculate the direction of qibla which

is used further in displaying pointer, toward qibla , on

the real time compass. By moving the mobile, the

compass as well as pointer moves according to the

qibla direction.

3.1.4 Maintaining History

Another feature of this application is that it maintains

the user history.

When user tap Get Route button, a file is appended

with destination place and current place name with

total distance and current date.

User can retrieve history by taping the history button

available on GetDirection.java Activity.

Page 27: Final FYP Report

Chapter 4

Components and Architecture

Page 28: Final FYP Report

Components and Architecture

Plan Your Way [An Android Application] 16

System Diagram

4.1 Basic Architecture

Basic architecture for my application Plan Your Way consists of:

Three-tier Architecture

E.g. Interface layer, Data Access Layer and Program Logic

Input place conversion to Coordinates and vice versa.

E.g. Geo Coding and Decoding

Google Database

Mobile Hardware Devices

E.g. Compass, GPS, Wi-Fi

API`s (Application Program Interface)

E.g. Google Maps, Google Places, Google Direction and Google Weather API`s

Page 29: Final FYP Report

Components and Architecture

Plan Your Way [An Android Application] 17

4.2 Hardware & Other Components

The following picture shows the hardware & other components that I used in my project Plan

Your Way.

The GPS is getting the current location of a user. The surrounding information is well

known to the user when the current location is identified correctly.

Compass is getting the NEWS (North East West South) direction information.

Maps are loaded from internet and displayed on mobile device.

Compass

Page 30: Final FYP Report

Components and Architecture

Plan Your Way [An Android Application] 18

4.3 Google Data Base and API`s

All information about places and direction is collected from already maintained database by

Google Corp. Google has one of the largest but also one of the greenest data center

infrastructures among the world’s companies. Google has been an industry leader in releasing

information about the world which consists of places, roads, etc.

4.3.1 Map API

Google Map API is used to inter link mobile phone with the world using maps. This

application retrieve map from cloud and put it on screen of smart phone for user interaction

with the world. This API also allow to get the input from user as he/she touch on the map and

map can be animated using program logic.

4.3.2 Places and Direction API

The Google Places API is a service that returns information about Places — defined within

this API as establishments, geographic locations, or prominent points of interest — using

HTTP requests. Place requests specify locations as latitude/longitude coordinates.

The Google Directions API is a service that calculates directions between locations using an

HTTP request. You can search for directions for several modes of transportation, include

transit, driving, walking or cycling. Directions may specify origins, destinations and

waypoints either as text strings (e.g. "Chicago, IL" or "Darwin, NT, Australia") or as

latitude/longitude coordinates. The Directions API can return multi-part directions using a

series of waypoints.

Page 31: Final FYP Report

Chapter 5

Methodology

Page 32: Final FYP Report

Methodology

Plan Your Way [An Android Application] 20

5.1 Data Flow

Data flow depends on the functionality of the application either data is retrieve from internet or

sent over internet in the form of query. Data also flows between different activities of application

and between different layers of application such as interface and data access layer for

information processing.

Get current location from GPS of mobile phone and destination place from user from

interface.

Calculate Distance and Direction as well as displaying route on the Google Map.

Send query about interested places to Google Database and get the result in JSON format

further which is processed and presented on the user screen.

Getting the position or rotation of mobile from Compass sensor build in the device and

relatively calculating the Qibla direction from user`s current location acquired previously.

5.2 JSON (Java Script Object Notation)

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for

humans to read and write. It is easy for machines to parse and generate. It is based on a subset of

the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999.

JSON is a text format that is completely language independent but uses conventions that are

familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript,

Perl, Python, and many others. These properties make JSON an ideal data-interchange language.

JSON is built on two structures:

A collection of name/value pairs. In various languages, this is realized as an object,

record, dictionary, hash table, keyed list, or associative array.

An ordered list of values. In most languages, this is realized as an array, vector, list, or

sequence.

Page 33: Final FYP Report

Methodology

Plan Your Way [An Android Application] 21

5.3 Geo Coding and Reverse Geo Coding

Geocoding is the process of finding associated geographic coordinates (often expressed as

latitude and longitude) from other geographic data, such as street addresses, or ZIP codes (postal

codes). With geographic coordinates the features can be mapped and entered into Geographic

Information Systems, or the coordinates can be embedded into media such as digital photographs

via Geo tagging.

Reverse geocoding is the opposite: finding an associated textual location such as a street address,

from geographic coordinates.

A Geo coder is an algorithm of a piece of software or a (web) service that helps in this process.

5.4 Interface and Information Exchange

Different XML files are used in project for creating Screen interfaces of application. While .java

files have been used for accessing these interface objects or views for displaying information on

screen in some proper way or format

Data exchange between XML file and Java files are in the form of Strings, so lot of string

process involves in whole project.

5.5 Data Base File Handling and API`s

All information about places and direction is collected from already maintained database by

Google Corp. Google has one of the largest but also one of the greenest data center

infrastructures among the world’s companies. Google has been an industry leader in releasing

information about the world which consists of places, roads, etc.

Keeping History

One of the important feature of this application is that it maintains the user history.

File handling is used for keeping user history. When user tap Get Route button, a file is

appended with destination place and current place name with total distance and current date.

User can retrieve history by taping the history button available on GetDirection.java Activity.

Page 34: Final FYP Report

Methodology

Plan Your Way [An Android Application] 22

Map API

Google Map API is used to inter link mobile phone with the world using maps. This

application retrieve map from cloud and put it on screen of smart phone for user interaction

with the world. This API also allow to get the input from user as he/she touch on the map and

map can be animated using program logic.

Places and Direction API

The Google Places API is a service that returns information about Places — defined within

this API as establishments, geographic locations, or prominent points of interest — using

HTTP requests. Place requests specify locations as latitude/longitude coordinates.

The Google Directions API is a service that calculates directions between locations using an

HTTP request. You can search for directions for several modes of transportation, include

transit, driving, walking or cycling. Directions may specify origins, destinations and

waypoints either as text strings (e.g. "Chicago, IL" or "Darwin, NT, Australia") or as

latitude/longitude coordinates. The Directions API can return multi-part directions using a

series of waypoints.

Page 35: Final FYP Report

Chapter 6

Implementation

Page 36: Final FYP Report

Implementation

Plan Your Way [An Android Application] 24

6.1 Using the On-Device GPS

For this location-based application, it’s crucial that we know where exactly the device located.

And, for accuracy, we want the best location provider which is available on the device

Applications which use any sort of location data from the device need certain location

permissions. For this purpose, there are two options available. One is to use a coarse location that

returns a location which is based on cellular towers or known as Wi-Fi access points. This level

of result works great for determining what city we are in and maybe the locality. However, it

probably won’t be able to determine which street or block you’re on correctly.

The other option is to use the fine location, which uses the GPS on the device to get an accurate

position. It may take a little longer, but uses GPS satellites and cellular towers to increase the

location accuracy. Fine location data can be helpful for determining what side of the street we

are on. It’s basically the level of accuracy and exactness that is generally used for AR apps.

So the next step here will be to add permissions in the manifest file.To Listen the Location by

using the Location Listener interface. It will include methods will deal with the location data

when a location is changed, setting the accuracy criteria, requesting location updates, getting the

best provider etc.

6.2 Calculating Distance between Two Points

We are interested in the direction and route guidance from current location to destination

location. In navigation, this is called the bearing. A path between two points on a spherical

object, such as the planet Earth, is shortest by following what’s called the great-circle distance.

By using TSP (Traveling Salesman Problem) techniques, Direction API finds shortest route

between locations, this would be reasonable distance mechanism to use. As we input destination

location to the system, API implement the algorithm we only need to parse the information came

as an output from API.

An alternate solution might be to calculate a straight line, in 3D space, between two points on the

sphere. This method assumes that a path through the sphere, as opposed to around its surface, but

this method is not in the least useful.

Page 37: Final FYP Report

Implementation

Plan Your Way [An Android Application] 25

6.3 Finding the interested places

A Nearby Search algorithm in application lets search for Places within a specified area. We can

refine our search request by supplying keywords or specifying the type of Place we are searching

for.

A Nearby Search request is an HTTP URL of the following

form:https://maps.googleapis.com/maps/api/place/nearbysearch/output?parameters

where output may be either of the following values:

JSON (recommended) indicates output in JavaScript Object Notation (JSON)

xml indicates output as XML

We only need to parse this information so that we used this for our specific purpose in

application. E.g. To display nearby places on the Google Map using markers and other icons.

Page 38: Final FYP Report

Implementation

Plan Your Way [An Android Application] 26

6.4 Finding the Qibla direction

For finding Qibla direction at particular place firstly we get the current location from GPS or

through cellular towers then we calculate the bearing or direction angle between the coordinates

of our location towards the Qibla or Mecca coordinates.

Mobile`s build in compass is used to get the value of rotation towards N, E, W, S (North East

West South)poles which is used to rotate the pointer as well as compass accordingly.

A user friendly menu is created in XML which is used to handle all these operations in my

application “Plan Your Way”.

Page 39: Final FYP Report

Chapter 7

Results

Page 40: Final FYP Report

Results

Plan Your Way [An Android Application] 28

Main Menu

Warnings for Internet

Connection

Get Direction

Activities

Page 41: Final FYP Report

Results

Plan Your Way [An Android Application] 29

Interested Places

Activities

Map View

&

SattiliteView

When

Universities is

selected from

drop down

menu

Page 42: Final FYP Report

Results

Plan Your Way [An Android Application] 30

When Hospital is

selected from drop

down menu

Qibla Direction

Activity

Page 43: Final FYP Report

References

Page 44: Final FYP Report

References

Plan Your Way [An Android Application] 32

Web sites

http://www.lynda.com

http://www.howstuffworks.com/augmented-reality.htm

http://developer.android.com/guide/topics/location/index.html

http://developer.android.com/training/articles/security-tips.html

Books

Beginning Android™ Application Development by Wei-Meng Lee

Android Programming Tutorials by Mark L. Murphy

Papers Boris V. Cherkassky , Andrew V. Goldberg , Tomasz Radzik, Shortest

paths algorithms: theory and experimental evaluation, Mathematical

Programming: Series A and B, v.73 n.2, p.129-174, May 31,

1996 [doi>10.1007/BF02592101]

Pettie, S., Ramachandran, V., Sridhar, S.: Experimental evaluation of a

new shortest path algorithm. In: Mount, D.M., Stein, C. (eds.) ALENEX

2002. LNCS, vol. 2409, pp. 126–142. Springer, Heidelberg (2002)