Location based services in Mobiles (GPS/AGPS)
One of the most important features in today’s mobile phones is LBS (location based services). Service that let you find the device’s current location. This includes technologies like GPS/AGPS.
What is GPS and AGPS?
These are two ways through which device can calculate its current location. GPS means Global positioning System and AGPS means Assisted Global positioning System.
How location is expressed on electronic MAP?
Latitude, longitude and Altitude are the values to express location.
How GPS calculates devices location?
There are different ways GPS can calculates devices location. These are also called GPS Modes. The GPS modes that the application uses to retrieve location information can affect the initial speed of the GPS Fix and level of accuracy. GPS Modes includes.
- Autonomous
- Assisted.
- Cell Cite.
1. Autonomous -> This mode mainly relies on GPS positioning satellites. Example of autonomous GPS system are , Car navigation systems.
2. Assisted -> This mode relies on GPS positioning satellites and servers on the wireless network. AGPS is basically a technology that provides additional function to full blown GPS Chipset. Example of AGPS systems is “Modern Mobile handsets based GPS. (Google’s navigation application for android based handsets.)”
3. Cell cite. There are ways location can be calculated from mobile cell sites ID as well. Google has web based API available that can calculates location based on Cell Site of the handset.
1. Autonomous GPS->
There are factors that play its role in location calculation.

First Fix -> . As shown in the image below. Status screen of GPS satellites’ Status screen shows 2 circles with numbers seemingly located at random over the top of them. These numbers represents the expected locations for satellites at your location and time. Knowing the approximate location and satellite number for the expected satellites aids in determining your first fix. This implies that unit must already think it knows your approximate location and approximate time.
The approximate location of all the satellites is stored in the machine in what is called Almanac. The Almanac provides the data you see on the screen and aids the GPS by letting it know which satellites are likely to be available. The almanac data is usually good for 3 months and updated automatically when unit is on.
Cold Start -> First time you turn on the GPS unit, it must perform a cold start. To perform a successful cold start it must have current almanac (a reasonable expectation of its current location and reasonable idea of current time). Given the data the only thing it need in order to calculate a fix is 3 or 4 satellite. The data it needs is called ephemeris data and this data is transmitted every 30 second from the satellite in consultation. It takes 18 seconds to download this information because it is only being downloaded at 50bps.
Warm Start -> If you turn your GPS unit off and turn it back again, you will notice that it is able to compute a fix much quicker than it first calculated. The ephemeris data is valid for 4 hrs. considering that sattelite makes a full orbit in 12 hrs and earth is moving underneath.
2. Assisted AGPS -> In Assisted GPS mode GPS system takes assistance from network servers to determine location. Please follow the image AGPS Picture.
.
This is mainly used in mobile phones, This is more reliable then autonomous GPS. Location is calculated faster then autonomous. Some AGPS devices work even beyond network range. but most of then just cease working. Advantages of AGPS over normal GPS.
- Faster location acquisition.
- Less processing power required of device.
- Saves battery.
- Location acquisition indoors, or in non optimal environments. e.g. in tall buildings or in cloudy situations.
3.Cell Cite -> location can be calculated from Cell cites id. there is google api available for calculating location from cell id, an example of this is given below. This is best suited for devices those doesnt have GPS receiver in them.
It was little bit about location. How it is calculated and what are the factors affecting in calculation of location in various modes. Now in mobiles there are various platforms in which location can be calculated.
1. J2me -> cellid , and LBS - JSR 179 .
2. RIM -> cellid, JSR 179
3. Google Android -> cellid, Google Location manger, Google map api.
1. Location Calculation in J2ME
// Method for Location calculation in JSR 179.
public void checkLocation() throws Exception {
String string;
Location l;
LocationProvider lp;
Coordinates c;
// Set criteria for selecting a location provider:
// accurate to 500 meters horizontally
Criteria cr= new Criteria();
cr.setHorizontalAccuracy(5000);
cr.setVerticalAccuracy(5000);
// Get an instance of the provider
lp= LocationProvider.getInstance(cr);
// Request the location, setting a one-minute timeout
l = lp.getLocation(120);
c = l.getQualifiedCoordinates();
if(c != null ) {
// Use coordinate information
double lat = c.getLatitude();
double lon = c.getLongitude();
string = “\nLatitude : ” + lat + “\nLongitude : ” + lon;
new GetData(midlet,lat,lon).start();
} else {
string =”Location API failed”;
}
formRunning.append(”Obtained coordinates…”);
midlet.displayString(string);
}
Geocoding or reverse geocoding examples / service can be found at following link .
2. Method for location calculation in RIM (Blackberry platform)
You can get location in blackberry using following methods. In Blackberry devices JSR 179 is available from 4.0.2 onwards and from5.0 onwards JSR 179 extension is also abailable.That provides certain extra features.
/* JSR 179 */
Criteria myCriteria = new Criteria();
/* JSR 179 extension */
BlackBerryCriteria myBlackBerryCriteria = new BlackBerryCriteria(…);
/** Single location fix*/
/* JSR 179 */
Location myLoc = myProvider.getLocation(…);
/* JSR 179 extension */
BlackBerryLocation myBlackBerryLoc = myBlackBerryProvider.getLocation(…);
/** Continuous location fixes */
/* JSR 179 */
myProvider.setLocationListener(…);
/* JSR 179 extension */
myBlackBerryProvider.setLocationListener(…);
/* JSR 179 */
double lat = myLoc.getQualifiedCoordinates().getLatitude();
double lng = myLoc.getQualifiedCoordinates().getLongitude();
double alt = myLoc.getQualifiedCoordinates().getAltitude();
/* JSR 179 extension */
double lat = myBlackBerryLoc.getQualifiedCoordinates().getLatitude();
double lng = myBlackBerryLoc.getQualifiedCoordinates().getLongitude();
double alt = myBlackBerryLoc.getQualifiedCoordinates().getAltitude();
http://www.blackberry.com/developers/docs/6.0.0api/lbs-summary.html#GPS
3. Method for location calculation in Android
In Android location capabilities can be added into application using package android.location. The main component of location framework is LocationManager a system service. As other system services locationmanager can not be directly instantiated. We can request an instance from system by calling getSystemService(Context.LOCATION_SERVICE).
// Get the location manager
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
// List all providers:
List<String> providers = locationManager.getAllProviders();
for (String provider : providers) {
printProvider(provider);
}
Criteria criteria = new Criteria();
bestProvider = locationManager.getBestProvider(criteria, false);
output.append(”nnBEST Provider:n”);
printProvider(bestProvider);
output.append(”nnLocations (starting with last known):”);
Location location = locationManager.getLastKnownLocation(bestProvider);
http://developer.android.com/guide/topics/location/obtaining-user-location.html