It seems to be a silly question but it might affect the design of application that I m developing .
Fused location providers provides location data in onLocationChanged () callback only when device gps is turned on. So i m confused what's the benefit of using fused location provider if It has such a dependency on device gps ?
Please help to explain
Thanks
What's the benefit of using fused location provider if it has such a dependency on device gps ?
The FusedLocationProvider may or may not use GPS, depending on the accuracy and update interval that you request. The main benefit is that the FusedLocationProvider conveniently abstracts the process of choosing suitable providers (WiFi, GPS, Network, BLE) and fusing the location info from those providers, hence the name.
The best choice of providers can depend on both the capabilities of the client device as well as your physical surroundings (e.g. WiFi might perform better than GPS in an urban environment with lots of tall buildings, while out in the wilderness it will be the other way round). So unless you need fine-grained control of the location providers I would suggest letting the FusedLocationProvider / the Google API decide.
Regarding application design: I have written a utility class, called the LocationAssistant, which will actually handle most of the setup for you. You might find it useful, as you're left with only a few simple interface methods to implement.
Related
The documentation that Google provides for their Fused Location Provider API says that, "The fused location provider manages the underlying location technologies, such as GPS and Wi-Fi, and provides a simple API that you can use to specify the required quality of service."
Looking at the source for FusedLocationProvider, I can see that it makes use of GPS and Network (which is presumably Wi-Fi and cell). However, that source hasn't changed since 2012.
Do Android devices ever use other sources of location data like the magnetometer in FusedLocationProvider implementations?
I am developing an app in Android that reports location to a server, and I was wondering to implement the new released Fused Location API, made by Google. Testing it, indoors and with setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
instantly takes networks providers to get location. So, my question is, what see Google in a few seconds to determine that gps is not a good option? I know that gps provider doesn't works properly indoors, but in my office sometimes (it takes an average of 10 secs) it works. Thanks
Well the library itself is not open-source, but I'm sure we can agree on how it does what your describe above:
If the GPS provider is disabled, or if the signal is too weak, or if the fix takes too long, then it returns the last known location and/or the network provider's location.
Seems reasonable. I guess the network provider serves as a fallback to the GPS provider in PRIORITY_HIGH_ACCURACY if GPS is not satisfying.
EDIT
Actually, the documentation says:
PRIORITY_HIGH_ACCURACY
This will return the finest location available.
It does not say it will only use GPS or prioritize GPS at all. It will just return the finest location, which is not always GPS, as #cYrixmorten pointed out: in urban areas, wifi spots are often more accurate.
we are developing an application in android which uses cellular(GSM) network location service (NOT GPS).Drains battery very fast when we use this location service in our application...
I dont know what causes this draining .. any pitfalls, suggestions?
thanks for help
Instead of requiring the location every time you have to request the Last Known Location.
Get the Last Known Location
check:
Fused Location Provider
use the fused location provider to retrieve the device's last known
location. The fused location provider is one of the location APIs in
Google Play services. It manages the underlying location technology
and provides a simple API so that you can specify requirements at a
high level, like high accuracy or low power. It also optimizes the
device's use of battery power.
Read more:
Adjusting the model to save battery and data exchange
I am trying to design an app which requires current location of the user time and again. So, whenever cellular data is available, i use mobile network to get the current user location. If mobile network is not available, can I reliably use GPS to get access to current location. If not, can anyone suggest what should I do in such cases?
Edit: Location services doesn't work very well. I already tried using it.
I think you should take a look at Android Location APIs:
https://developer.android.com/google/play-services/location.html
Android uses what they call Fused location provider. It is Android (through Google play services) responsability to choose which provider (GPS, sensors, WIFI fingerprinting...) is best each time to get current user location.
I think it is a great technology and APIs are really simple to use
According to Google Docs:
Knowing where the user is allows your application to be smarter and deliver better information to the user. When developing a location-aware application for Android, you can utilize GPS and Android's Network Location Provider to acquire the user location. Although GPS is most accurate, it only works outdoors, it quickly consumes battery power, and doesn't return the location as quickly as users want. Android's Network Location Provider determines user location using cell tower and Wi-Fi signals, providing location information in a way that works indoors and outdoors, responds faster, and uses less battery power. To obtain the user location in your application, you can use both GPS and the Network Location Provider, or just one.
If you want more detail you can take a look at :
http://developer.android.com/guide/topics/location/strategies.html
yes If there is no Network available then you can go for GPS but we must use it smartly and efficiently
because GPS give much accurate location than network, but it reduce the battery life and also you can use Pending Intent for getting location and broadcast receiver at the place of Location Listener
but I suggest you this link with light this topic in much detail
These are some smart coding concepts for increasing battery life
I would like to get the latitude and longitude of a device, if the GPS is off, well hopefully can be a precise location
You should use the new LocationClient that is part of Google Play Services Location API. It uses a fused provider that automatically determines what is the best provider available at that moment. It also uses other sensors to get a more accurate location.
you can get your location from three techniques and each one called Provider and each one has some pros and drawback and uses you don't care about it Google play services will making it for you but you need to have good understand of that , the three ways is
from GPS , Network , SIM(mobile device with sim)
and here some implementations of the techniques
http://developer.android.com/guide/topics/location/strategies.html