Gps Presentation

Post on 17-Jul-2016

24 views 0 download

description

Gps Presentation

Transcript of Gps Presentation

Latitude and longitude

• Firstly to Find the latitudes and longitudes, we need to implement location listener which locates the latitudes and longitudes to the respective location.

• For Eg:->private class GPSLocationListener implements

LocationListener

• Now we use 2 functions to get the values of latitude and longitude.They are:-

1)getLatitude();2) getLongitude();

For eg:-> location.getLongitude(); location.getLatitude();

• We can find the last known lpcation by using the function ,

->getLastKnownLocation(LocationManager.GPS_PROVIDER);• But to use this function we need to use the

location manager class which cintains the above function.

• When we want to change the location, we do it by using the function –

onLocationChanged(Location location); In this function we use another

class known as Geopoint which gets the new latitudes and longitudes to get the desired location.

• To use all these functions and classes we need to import some header files-

->import com.google.android.maps.GeoPoint;->import android.content.Context;->import android.location.Location;->import android.location.LocationListener;->import android.location.LocationManager;

Retrieving location

• To retrieve the location we use a function called- requestlocationUpdates() of the LocationManager-class.

• requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, locationListener);

Display Location

• To display the current location we use the function-showCurrentLocation().

• We can toggle the view mode from satellite view to street view by using setSatellite(boolean) and SetStreetView(boolean) functions of mapView class.

• The view mode can be enabled by setting the parameter value as true and disabled by setting it as false.

• Eg:-> mapView.setStreetView(false);mapView.setSatellite(true);

XML• XML-coding->we need to fix the size of the application screen of the

application.• android:layout_width="match_parent"• android:layout_height="346dp"• android:layout_weight="1.21“.• Then we need to give the api key for the application to use google

maps-• for eg:->

android:apiKey="02GmVuYaSbFnhvhfcbcxuzjZgQJVmoYmQx3OOqJpSkGEprrw"

• We also need to give the url for the apk file for mobiles for android application-

• xmlns:android=http://schemas.android.com/apk/res/android.

• According to the phone we can align the screen vertically or horizontally-

• android:orientation="vertical"

Permissions• To use any of the google products we need to get the permissions and

certification from google.these permissions need to be included in the manifest.xml file.

• <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

• <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

• <uses-permission android:name="android.permission.INTERNET" /> • <application android:icon="@drawable/ic_launcher"

android:label="@string/app_name"> • <uses-library android:name="com.google.android.maps" />

Sample code

package com.VertexVerveInc.GPSLocator;

import com.google.android.maps.MapActivity;import com.google.android.maps.MapView;import com.google.android.maps.MapController;import com.google.android.maps.GeoPoint;import android.content.Context;import android.location.Location;import android.location.LocationListener;import android.location.LocationManager;

1) Location location =

locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

2) if (location != null) {String message =

String.format("Current Location \n Longitude: %1$s \n Latitude: %2$s“, location.getLongitude(), location.getLatitude());

3)-private class GPSLocationListener implements LocationListener { @Override public void onLocationChanged(Location location) { if (location != null) { GeoPoint point = new GeoPoint( (int) (location.getLatitude() * 1E6), (int) (location.getLongitude() * 1E6));}

Introduction

• The Global Positioning System (GPS) is a space-based satellite navigation system that provides location and time information in all weather conditions, anywhere on or near the Earth where there is an unobstructed line of sight to four or more GPS satellites.

• The system provides critical capabilities to military, and commercial users around the world.

• . It is maintained by the United States government and is freely accessible to anyone with a GPS receiver.

• GPS was created and realized by the U.S. Department of Defense (DoD) and was originally run with 24 satellites. It became fully operational in 1994. Roger L. Easton is generally credited as its inventor

Importance of GPS

• GPS modernization now upgraded with new capabilities to meet growing military, civil, and commercial needs.

• The program is being implemented through a series of satellite acquisitions, including GPS Block III and the Next Generation Operational Control System (OCX).

• It has significant military and civilian applications.

• GPS has become a widely deployed and useful tool for commerce, scientific uses, tracking, and surveillance. GPS's accurate time facilitates everyday activities such as banking, mobile phone operations, and even the control of power grids by allowing well synchronized hand-off switching.

Applications

Some good applications are:-• Tectonics: GPS enables direct fault motion

measurement in earthquakes.• Telematics: GPS technology integrated with

computers and mobile communications technology in automotive navigation system

• Robotics:Self-navigating, autonomous robots using a GPS sensors, which calculate latitude, longitude, time, speed, and heading.

• Disaster relief/emergency services: Depend upon GPS for location and timing capabilities.

• Geofencing: Vehicle tracking systems, person tracking systems, and pet tracking systems use GPS to locate a vehicle, person, or pet. These devices are attached to the vehicle, person, or the pet collar. The application provides continuous tracking and mobile or Internet updates should the target leave a designated area.

• GPS Aircraft Tracking

Proposed system

• Proposed system features1)Get the latitudes and longitudes.2)User friendly interface.3)Provide a more fast and accurate approach

using google maps.4)Cell phone tracker-when lost or stolen.

References

• Web sites-www.stackoverflow.com-www.googlemaps.com-www.wikipedia.com-www.javacodegeeks.com-www.codeproject.com