How Fused Location determines if use GPS or Network provider? - android

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.

Related

How do I use the device's GPS only whenever there is no internet available?

Android is constantly changing. Currently, the Fused Location API is being used for location detection. But in my experience, without a Data connection, the GPS signal is not being found anymore.
How do I use the device's GPS only whenever there is no internet available?
Fused location provider uses a hybrid way to find gps using a variety of sensors, WIFI/data and the actual GPS chipset.
It will find the location COARSE/FINE accuracy is up to your case. It will just take a while longer than with the internet connection. If indoors or in an isolated area, it may very well take over a minute or two. Sometimes if the data signals just don't reach the device, yes it can fail.
It does work without WIFI or DATA in most cases.

Regarding Fused location Provider in Android to Fetch Location

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.

Making an App that requires constant current location

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

Android Fused Location provider gets lost

I've been testing android's new Location API's for a few weeks. In general they work quite well, however, the new Location provider frequently loses the plot.
Specifically, I wire up an example based on the receive location updates example. It works correctly, and the location updates are received as expected.
The problem seems to be with the Fused provider itself. In some areas (notably around my home) it completely gets lost. It will suddenly think I am kilometers away from where I am. Around where I work (which is a more built up area) it is much more accurate and always reasonably close to where I actually am (in Balanced mode).
I have made many attempts to fix this, including switching to PRIORITY_HIGH_ACCURACY when I suspect it is in error, or using the older LocationManager to try get a GPS fix to establish where I really am. But nothing seems to help too much. I suspect Google has bad data on where certain mobile towers of WiFi hotspots are around my home, and when it connects to certain towers is suddenly jumps a few km from the true location. It's very annoying and will interfere with the Geofence API also. Any advice on how I can fix this?
Can you just ignore the location updates that are inaccurate? This code was released at Google IO 2013 I think, so it might still have some bugs.
(I am experiencing the same thing as you. Rural area, the Fused Location provider is giving me locations all over the place)
There is bad data about some WIFI APs from time to time, and these tend to fix themselves after a while. A clue to what's happening to you can be found in the accuracy returned. If when it goes to the wrong place, the accuracy is a large number (hundreds of meters), that implies the fused location provider is using a cell location. It may mean there aren't a lot of APs where you live, and that you can only get a wifi location once in a while (or once in a while you can't get a wifi location). The FLP should get better at avoiding these jumps over time as algorithms improve.
If the bad location you get has a small accuracy (around 30 meters), that implies it's a wifi location, and bad AP database information probably explains the issue.

What is GPS,AGPS,LBS in android?

I'm working in android (developing application for mobile and tablets). I am using android version is 2.2.
In my application, I want to capture the longtitude,latitude.
My suprevisor is said to me capture the locations using GPS,AGPS,LBS
I'm new to android .I does not know GPS,AGPS,LBS.
Please send me the details, what are the difference,advantages,disadvantages of these 3?
Don't compare LBS with GPS and AGPS. LBS stands for Location based services . It's a service done with the help of GPS/AGPS . For example 'Requesting the nearest business or service, such as an ATM or restaurant' is a service required by a user. There are many applications available for to provide above service. Those application will use either GPS/AGPS to find the location and service to user based on the location fetched.
So simply any application which use location to serve users are considered as LBS.
Following is the difference between GPS and AGPS
The difference between GPS and A-GPS is actually pretty straightforward. A GPS phone comes with a built-in GPS chip. GPS, short for Global Positioning System, is typically used to determine the location, speed, direction and time of the device. So, for example, in the case of the Mobile, when GPS is activated on the unit, the system would be able to triangulate the position of the receiver when three or more satellites are connected. And since it is able to calculate speed and direction, GPS is also commonly used as a navigation device while driving.
A-GPS (Assisted-GPS), on the other hand, was developed to enhance the performance of GPS. This is especially useful in environments where the GPS chip may have difficulty in getting a satellite signal, such as an urban canyon, or places where there is too much overhead obstruction. What A-GPS does is it leverages on an intermediary called an Assistant Server which provides information on cell ID or other data to help the device identify the right satellites to connect to. This shortens the time needed for a location lock although certain A-GPS solutions require an active connection to a cell phone network.
Pros and Cons of GPS and AGPS:
The realiability and Accuracy is high in the GPS and it is low in AGPS.
The location captured by AGPS is not as accurate as GPS.
The location capturing via GPS is time consuming and power (Battery) consuming, etc.
Hope it helps. For more details on A-GPS
GPS - Global positioning system -> get your location via satellites
AGPS - Assisted GPS -> get your location via satellites and network providers
LBS - Location Based Services -> doesn't have much to do with getting your location.
Basically, in Android you can get your location using following providers:
Network: get your location based on your wifi connection. fairly fast, but not so accurate
GPS: get your location based on GPS receiver. fairly slow, but quite accurate
so you have a trade-off: either to use Network provider and get your results fast, or to use GPS provider and get more accurate data.
Read more here:
http://developer.android.com/guide/topics/location/strategies.html
LBS - Location Based Services
GPS - Global Positioning System
AGPS - Assisted Global Positioning System
LBS
As abbas.aniefa said, We can't say differences of LBS over GPS and AGPS. It is the service which uses GPS/AGPS to find location. Android provides a number of building blocks for location based services.
GPS
GPS, the Global Positioning System run by the United States Military.
This provider determines location using satellites.
Depending on conditions, this provider may take a while to return a location fix.
Advantages
It will give our location accurately,
It will work fine in out-door locations.
Disadvantages
It may be very very slow in in-door locations,
It will quickly drain battery.
It will be slower than network provider.
A-GPS
A-GPS - Assited GPS. Normal GPS can take a long time to get a position fix. For this reason most cell phone companies have the GPS in the phone turned off except for emergency calls and for services they sell you (such as directions).
A-GPS will come under network location provider category because it uses GPS chip on device, as well as assistance from the network (cellular network) to provide a fast initial fix.
Advantages
It will give our location very accurately in-door location itself,
Drainage of battery will be saved,
It will be faster than GPS Provider.
Disadvantage
We can not use it with GPS alone. It will depend on network connection.
Over all Differences of GPS and A-GPS
GPS
Uses GPS chip on the device,
Line of sight to the satellites,
Need about 7 to get a fix,
Takes a long time to get a fix,
Doesn’t work around tall buildings.
A-GPS
Uses GPS chip on device, as well as assistance from the network (cellular network) to provide a fast initial fix,
Very low power consumption,
Very accurate,
Works without any line of sight to the sky,
Depends on carrier and phone supporting this (even if phone supports it, and network does not then this does not work).
I think GPS is done/processed via satellite communication without any network service provider.
The AGPS is done/processed via the network (which is provided by service provider such as Airtel,Vodafone,etc).We should pay for service provider for usage of network.
The LBS is processed through the AGPS.
I dont know whether my points are correct or not.Im heard from others and put it.
All are welcome to give their suggestions,ideas,etc.

Categories

Resources