I am using googleApiClient with LocationServices api to get the location.
I am able to get last location if In phone settings wifi & mobile network location is checked.
But If I unchecked the wifi & mobile network location. It does not provide any location. while GPS Settings in checked in both cases.
My question :- Google's new api can get location from gps or not. ?
Google's new api can get location from gps or not. ?
may be yes.
But as per Google
The Google API Client provides a common entry point to all the Google Play services and manages the network connection between the user's device and each Google service.
We must have to provide the network access either wifi or mobile-data for getting the actual location's co-ordinate.
Related
Is it possible to get location in android without enabling location service of android device ? I need to get location from nearest mobile tower, so is it possible ?
You could use getLastKnownLocation() of FusedLocationAPI. This doesnot involve enabling location services.
As per docs:
Using the Google Play services location APIs, your app can request the
last known location of the user's device. In most cases, you are
interested in the user's current location, which is usually equivalent
to the last known location of the device
.
I am trying to get current exact user's location coordinates, and update the location when the user moving without internet connection in android.
which says "Common sources of location information include Global Positioning System (GPS) using GPS-PROVIDER
and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs using 'NETWORK-PROVIDER'.
It is well known that the GPS doesn't need internet connection to get the location.
So the question is what about the network provider??
Can I use network provider when internet connection is OFF ? if not ? why !!
I think it can work without internet because it Depends on GSM/CDMA cells so it will get the location by the Signals connect with cell tower, I hope I'm thinking right.
By the way I have not used the google location Apis (client & server) because I read more than once that it needs an Internet connection,
that's why I'm using now Android APIs locationManager().
As far as I know, google's location API's makes the most out of the network connection when it comes to location.
Either way, from Android developers: "The Google Play services location APIs are preferred over the Android framework location APIs (android.location) as a way of adding location awareness to your app. If you are currently using the Android framework location APIs, you are strongly encouraged to switch to the Google Play services location APIs as soon as possible."
Follow this link for more info:
https://developer.android.com/training/location/index.html
I want to fetch the location using google play services LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient); when GPS/Wifi is turned off. Reading the articles/blogs regarding FusedLocationApi, its mentioned that this API will provide the accurate location using any of GPS/Wifi or Cellular network. I am confused that if cellar network can provide the location then FusedLocationApi should return the location if Gps/Wifi is disabled but its returning null. Can anyone please let me help/guide to fetch offline location using cellular network.
Regards
You cannot get location using the cellular network through the standard API when GPS and WiFi location are disabled.
The device must have location enabled in order for an application to retrieve location. This is a basic permissions issue for the end user; if the end user requests that no location be available, then no location is available.
When retrieving location, there are two sources of information:
GPS: This uses satellites in space to locate the device. GPS provides the most accurate location, but is slow, especially if you do not have a data connection. On the device this is the "device only" mode.
Network: This uses WiFi and/or the cellular network. There is not a way to choose WiFi and cellular location separately. When you get a location update, the horizontal accuracy is a strong indicator of whether WiFi or the cellular network was used. WiFi accuracy should be in 10's of meters, while cellular will probably be 100's of meters. If you are in an area without WiFi coverage but with cellular coverage, then the network source will still provide location updates.
You can also use both these sources. This is the "high accuracy" location mode.
If you turn both of these off (disable location), then you will not get any location.
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
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.