0

In Android I have seen many ways of getting Location. I have read this and this about Location and Also I have came to know about Fused Location Api.

My Case in App is that, When User Starts the App it must Fetch the location in a quickest way posssible . As I have to do some specific task based on user location.

So by the time Now I am using the location services. In this I have tried the Loation from GPS and Location From Network. but both of them requires my Location to be Enabled but I think that it should not matter if I am fetching location from the netwrok ? Is it ?

So what you guys would suggest me to how to get the Location ? which should return reply fast and accurate ?

  1. What is the main difference in Location from GPS and Network as both need Location to be enabled ?
  2. What is meant by the best provider in the Context ?
  3. How does the Fused Location work ?
  4. Shuld I go For Location Services of Fused Location API as my app would use data or wifi (internet) for further working ?

Please argue on this my these confusion ? what is best for me can some one please sunder stand my case and answer me accordingly ?

Coas Mckey
  • 701
  • 1
  • 13
  • 39

2 Answers2

5
  1. Location you get from GPS is more accurate than the location you get from the network,so if you need accuracy use GPS

  2. Not sure about this but i think its about the context what type of location you want like you want the accuracy or the fastest one so according to that choose your provider

  3. FusedLocation provider is the most efficient and effective solution for getting the location on android now,it gathers the location data from different sources and according to the parameters passed like in how much time you want location to be updated,you want high accuracy or not etc.It provides you the best location.

  4. Yes you should use the FusedLocationProvider for getting the location on android,as google also recommends this and it the most effective and efficient way there to get location on android for now.

I hope this will help you in making a decision.

Tim
  • 41,901
  • 18
  • 127
  • 145
Pramod Yadav
  • 2,316
  • 2
  • 23
  • 36
1

gps –> (GPS, AGPS): Name of the GPS location provider. This provider determines location using satellites. Depending on conditions, this provider may take a while to return a location fix. Requires the permission android.permission.ACCESS_FINE_LOCATION.

network –> (AGPS, CellID, WiFi MACID): Name of the network location provider. This provider determines location based on availability of cell tower and WiFi access points. Results are retrieved by means of a network lookup. Requires either of the permissions android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION.

Android have Fused location provider

The Fused Location Provider intelligently manages the underlying location technology and gives you the best location according to your needs. It simplifies ways for apps to get the user’s current location with improved accuracy and lower power usage

Fused location provider provide three ways to fetch location

  1. Last Location: Use when you want to know current location once.

  2. Request Location using Listener: Use when application is on screen / frontend and require continues location.

  3. Request Location using Pending Intent: Use when application in background and require continues location.

mdDroid
  • 3,135
  • 2
  • 22
  • 34
  • what if I want my user location to be continue to get prediocally to be sent on server , for this I think I have to deploy fused location as service ? how can I get my app to retrive the location even it is closed or in back ground or force closed ? – Coas Mckey May 30 '16 at 08:41
  • @CoasMckey I used foreground service for that purpose. – Leonid Nov 08 '16 at 13:22