Fused location provider - location recorded only when WiFi On - android

Phone: Nexus 4, Android 4.4.2, Google Play Services 4.3.25 (1117461-036)
Goal:
I want to record GPS positions via the fused location provider.
The code works the "standard" way": using location client and location request, registering for updates in onConnected with the pending intent starting intent service for handling of each location update received.
The LocationRequest.PRIORITY_HIGH_ACCURACY accuracy is used.
The problem is this
I turn on Location in settings (I see Mode: high accuracy there), and then press the button to start recording of positions
However, no updates are received.
Then, I turn on WiFi and suddenly, the updates are received.
The strange part is that I don't have to connect to any WiFi network. It is enough that I just turn WiFi on in the settings
Now, when I turn off the WiFi completely, and then start recording again, I get the updates as expected
It seems that even when using the high accuracy, the fused location provider isn't using GPS provider until WiFi is on.
Did anyone experience the same behaviour?

Related

Can GPS location be acquired in a phone without internet and SIM?

I'm trying to develop an android application which can acquire GPS location without using Internet and even network location using SIM. Actually, SIM will be inserted in phone and i know that location upto 500m accurate can be acquired through it. But in case of no SIM signals in the area, is it possible to acquire location?
Yes, you can use GPS without any external data connection because signals from the GPS satellites are receive-only.
On a device, the permission setting is known as device-only location mode:
Device only
This mode uses only GPS. It doesn’t use Google's Location service to provide location information. It can estimate your device's location slower and use more battery.
Yes You can get the coordinates but for using map services you need internet.The only thing is your GPS will take a bit longer to lock your location on a cold start, and it might not be quite as accurate.
It's a aGPS (Assisted GPS), and get's part of the location information from the data network (If available) on cold start, then fine-tunes the location further than what a GPS alone can do.
Shouldn't be an issue however, really. Just turn your GPS on a little sooner (Like while getting ready to leave, not waiting until you are in your car).
Yes. If you use the Location Manager, set the Provider to LocationManager.GPS_PROVIDER. If you use Google Play Services, it should work automatically.

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.

FusedLocationProvider finds location faster with GPS turned of

My android app relies on location. However the FusedLocationProvider which I use for this as abstraction layer so that I do not have to worry about what LocationProvider to use, behaves unexpectedly.
Scenario:
User opens app. I check for the availability of the providers and open the location settings page. The user enables "Access to my location" and both GPS and Wi-Fi location. When the user returns to the app I receive no location updates.
When I leave GPS turned off and only allow Wi-Fi in the System settings, I get an updated location.
I tried the priorities PRIORITY_LOW_POWER and PRIORITY_BALANCED_POWER_ACCURACY which both did not give me a location update when GPS was turned off.
How does it come, that the detection of the location works with GPS turned off and doesn't when it is turned on? Does that make any sense?
The location I obtain, when GPS is turned off is accurate enough for what the app is doing. If the device has had LocationServices turned on for a longer periods of time (Including the phone being outside) I receive Location Updates even with GPS turned on.
Does someone have an explanation for this / know how to solve this?

get current location without internet - phonegap geolocation api for android

I am trying to get the user's current location using phonegap Geolocation api, which says "Common sources of location information include Global Positioning System (GPS) and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs". I am able to properly get the location when internet is ON (irrespective of the state of GPS).
Is there a way to get the location using triangulation when the internet is OFF or not accessible? (GPS might be ON or OFF)
A BIG "NO"! This is like cutting down hands and asking if I could clap now? GPS and NETWORK location providers are the only way to receive user device location.
For GPS location - you need GPS sensors to be ON.
And for NETWORK location you need to have internet connection ON, because in this case the location is calculated on the basis of Cell-Tower/Wifi-spot ID which is then sent to google servers (via internet) to fetch the location details of the respective Cell Tower or wifi spot. Google's location server have its own location approximation algorithms on the basis of which it tells your location.
So, there could be no way you could receive a location when both GPS and INTERNET are OFF.
Note: You can still get the last received location from any of these providers by using LocationManager's getLastKnownLocation() even when the providers are OFF. But this locations are usually outdated ones and are barely of any use.
{ enableHighAccuracy: true }
Enabling that option will allow the Android device to get the location even with the WIFI option disabled.

Why GPS provider returns location updates while the device has no access to sky?

I test my app on Samsung Galaxy Tab 2 (Android 4.0.3) and noticed strange behavior.
Both location providers and enabled, network and GPS. When the app gets onLocationChanged updates, some Location reports are from the Network provider, some from the GPS provider.
The strange thing is that I keep the tablet about 3 meters away from the nearest window. As far I known, in such conditions, GPS shouldn't be able to tune to the GPS satellites. So why GPS provider returns correct Location updates?
3m from window is no problem for a good GPS antenna, to receive a (bad) position. so the situation you described is not a guaranteed GPS shield.

Categories

Resources