September 24, 2018, 09:57:34 AM

Author Topic: How does GPS works in Android?  (Read 965 times)


  • Guest
How does GPS works in Android?
« on: October 11, 2013, 10:45:24 PM »
Currently I am working in a Android project which deals with the GPS technology and I am pretty new to this topic. So can someone give me the information on this? How does the Goolge Maps work? Is it only with this GPS or something else? Can you give me more information on this?

Offline infomaniac

  • Administrator
  • Full Member
  • *****
  • Thank You
  • -Given:
  • -Receive:
  • Posts: 173
  • Karma: +0/-0
    • View Profile
    • Poke This Member
Re: How does GPS works in Android?
« Reply #1 on: October 11, 2013, 10:57:31 PM »
GPS (Global Positioning System) in Android is something which is very interesting and at the same time a complicated concept behind it. Now to your question GPS doesnít work only with Google Maps or any other third party application which is used for GPS but it acts with the package named Android Location Manager API which enables the retrieving of the current location or to track the location changes.

Now for eg. when you open the Google Maps in your Android phone you will get a notification automatically whenever you try to find directions which will ask for the permission so when you say Yes it makes the android.permission.ACCESS_FINE_LOCATION flag to be enabled which will send the further information needed to the network.

The location related functions are located in android.position package which contains some of the classes like LocationManager, LocationProvider, Location, Geocoder, Address, GpsStatus, GpsSatellite.

Some of the code snippet for the above location related classes is as follows,

For LocationManager - LocationManager locationManager=(LocationManager)this.getSystemService(Context.LOCATION_SERVICE);

LocationManager class is nothing but the main class which provides the access to Androidís Location features.

For LocationProvider - LocationProvider provider = locationManager.getProvider(LocationManager.GPS_PROVIDER);

LocationProvider class helps to get the GPS provider who actually enables to provide the required data to your end device.

Now to make your Android device to start listening frequently to the provider the code which will be processed is as follows,

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, TIME_INTERVAL, DISTANCE_INTERVAL,listener);

In the above code to get the location at regular intervals we have some 4 params passed in the requestLocationUpdates where the LocationManager.GPS_PROVIDER as discussed before as the provider, TIME_INTERVAL - which can be set for the time interval check(update) for the user location. DISTANCE_INTERVAL - to check how far the user has to move before getting a notification. The listener which is mentioned is here is nothing but the LocationListener which again implement four methods which are onLocationChanged, onStatusChanged, onProviderEnabled and onProviderDisabled.

Now we were seeing the functions which are used mostly when the Android device is live for the notification and still lot more there. So now what about disabling the GPS option? the method which is called for this reason is,


The above methods and classes are the basic which works under the GPS system in Android device and still there are lot more to understand which will be a bit complex if we go through it now. So better try to understand the basics as above then for sure you can easily cope up with the rest by going through our forum in deep :)
« Last Edit: November 18, 2013, 05:14:40 PM by infomaniac »

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 
Copyrights © InfoManiac

Related Posts Plugin for WordPress, Blogger...