Android Location Providers - GPS or Network Provider? -


in application determine user's current location. have couple of questions in regard:

  1. there different location providers, 1 accurate? gps provider or network provider?

  2. in how far available provider differ? how function?

  3. could please provide me code-snippets or tutorials on how started implementing gps functionality in application?

there 3 location providers in android.

they are:

gps –> (gps, agps): name of gps location provider. provider determines location using satellites. depending on conditions, provider may take while return location fix. requires permission android.permission.access_fine_location.

network –> (agps, cellid, wifi macid): name of network location provider. provider determines location based on availability of cell tower , wifi access points. results retrieved means of network lookup. requires either of permissions android.permission.access_coarse_location or android.permission.access_fine_location.

passive –> (cellid, wifi macid): special location provider receiving locations without initiating location fix. provider can used passively receive location updates when other applications or services request them without requesting locations yourself. provider return locations generated other providers. requires permission android.permission.access_fine_location, although if gps not enabled provider might return coarse fixes. android calls these location providers, however, underlying technologies make stuff work mapped specific set of hardware , telco provided capabilities (network service).

the best way use “network” or “passive” provider first, , fallback on “gps”, , depending on task, switch between providers. covers cases, , provides lowest common denominator service (in worst case) , great service (in best case).

enter image description here

article reference : android location providers - gps, network, passive fernando cejas

code reference : https://stackoverflow.com/a/3145655/28557

-----------------------update-----------------------

now android have fused location provider

the fused location provider intelligently manages underlying location technology , gives best location according needs. simplifies ways apps user’s current location improved accuracy , lower power usage

fused location provider provide 3 ways fetch location

  1. last location: use when want know current location once.
  2. request location using listener: use when application on screen / frontend , require continues location.
  3. request location using pending intent: use when application in background , require continues location.

references :

official site : http://developer.android.com/google/play-services/location.html

fused location provider example: git : https://github.com/kpbird/fused-location-provider-example

http://blog.lemberg.co.uk/fused-location-provider

--------------------------------------------------------


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -