If you look at apps such as Google Maps app on Android, it display a gps icon, that when clicked starts the gps. However, if I don't click that image, and I move, it tracks me anyway. So what is the purpose of they button which we see in so many apps? Does the phone rely on GPS only when that button is pressed, or do they use the button, because they start the gps every x minutes, so if you click the button, it start it immediately?
?
The GPS radio is not started automatically.
When the GPS is off, the phone uses nearby WiFi nodes to find the location. That works pretty well in areas where there are a lot of known WiFi nodes, but the GPS is more exact, and works pretty much everywhere.
Applications like google maps have the gps logo because you may want to be shown your location, usually the application will try and find your location based on wifi and networks first and then using gps. The button will tell the app you want to know the location then and there and that's why it starts, other then that it should just do it automatically.
GPS isn't the only way to track a phone. When you don't have GPS enabled (or if your phone doesn't have a GPS chip in it), the cell phone can triangulate it's distance from the nearby cell towers. It can also do the same thing with nearby WiFi networks.
Since GPS takes up so much power, apps will ask you to enable GPS yourself instead of automatically enabling it when the app starts/runs in the background.
You can read more about common phone tracking methods here: http://en.wikipedia.org/wiki/Mobile_phone_tracking
Related
Is it possible to get the coordinates only with the mobile network enabled?
I need to get the coordinates within 30 seconds. Because when the user clicks the button to hide, it can not be too long to get the coordinates.
I can not use NETWORK_PROVIDER to get the coordinates of the Wi-Fi network because the user will be on the street and not connected to a Wi-Fi network, but will have the mobile data network connected.
Is it possible to get coordinates over the mobile data network?
I know GPS_PROVIDER is slower than NETWORK_PROVIDER, so I'd like to know if it's possible as I said above. Thank you!
Is it possible to get the coordinates only with the mobile network enabled?
Yes. For example, navigation apps work while driving in open spaces, far from any WiFi.
I need to get the coordinates within 30 seconds
There is no way to guarantee this. There is no way to guarantee that you can get a GPS fix in any amount of time. There are plenty of places in the world where it is difficult to get GPS signals.
I have make an android application which help us to get GPS Location using A-gps in my android phone. I am getting latitude and longitude successfully in Metro Cities of my country, but when I am going to some forest area,GPS do not get location and for this I need to run GPRS of my phone,after running google map once in my phone ,GPS successfully gets latitude and longitude even if I closes my internet connection or remove sim card from my phone. But since I do not want to use google map, what should I do now and why it is happening?? Any help will be appreciable
It takes a long time (several minutes) to get the GPS location with high precision. However, if you enable network based location (e.g. cell tower, WiFi), it's way faster but with lower precision.
As a result, you should listen to all the providers with LocationManager, and figure out which provides the best location. Or, if your app targets Android 8 and above, you can use the Location APIs provided with Google Play Services, which hides the details as using LocationManager directly.
First make sure that it is not the fault of your phone or its operation system version.
Download a well working known GPS App, look if they get a GPS signal without internet.
Place it under very good cointions: free view to sky, outside dense city, at least an open place.
You should get a signal within one minute, maybe if the phone has a poor built-in GPS antenna, a bit more, wait some minutes.
If the well working foreign app still don't get GPS it's an Operating system bug.
If you get one, then it´s your fault, and it is worth for further investigation.
*first check your GPS working or not properly with **ANDROITS GPS TEST*.
if it finds and fixes satellite do not worry. as AGPS is fast , standlone GPS needs to have much more time to fix on its own especially in city as many radio waves disturbs GPS fixure.
better first fix with AGPS and then you can turn off data or internet, still it will work as it already had its location and satellites fixed.
with standlone GPS it takes huge time and battery.**
If your phone use GPS h/w to get the location information, it don't require any internet connection. It should be able to get the location fix using GPS without the help of internet. But it may take some time to get the location fix.
You can install the this free app from play-store to test the GPS of your phone : "TestYourGPS".
https://play.google.com/store/apps/details?id=com.eorsavik.testyourgps
I'm working on an android app and i need to know the location of android device. All the methods I tried need GPS to be enabled. If it is not enabled, we can ask the user to turn it on by opening settings intent.
Is there any way to enable it via code, without even letting the user know.. and turn it off when the app has finished its job?
The app I'm working on will keep record of location of device. It will run in background and will note location every 15mins. To keep GPS enabled all the time will consume a lot of power. So i want to turn it on when i need and turn it off when i'm done, without asking the user.
For exact location, you need GPS to be enabled. But you can use NETWORK_PROVIDER, and get the latitude and longitude. This does not require user intervention. But, of course, its an approximate location but good enough to do location based searches.
lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0,
locationListener);
For privacy reasons, that will never be possible without rooting the device.
You cannot get the user's location without consent.
Is there any way to enable it via code, without even letting the user know.. and turn it off when the app has finished its job?
Fortunately, no, for obvious privacy and security reasons.
So i want to turn it on when i need and turn it off when i'm done, without asking the user.
On and off are not the same as enabled and disabled.
Just because the user has allowed GPS to be enabled does not mean that it is drawing power. Only if an app has requested location data will the GPS radio be turned on. So, you cannot enable GPS (only users can), but you can arrange for GPS to be turned on if it is enabled. The user will still see an icon in the status bar when GPS is on.
How does the spy apps and all do that then?
They require that GPS be enabled by the user.
When moving a big distance, like to another city, with the GPS off, it takes very much time for it, when turned on, to get the first correct point.
So if by example I register to the gps provider, it could take up to 10 min until the first onLocationChanged call.
The network provider will respond faster, but is less accurate.
Is there a way to help the gps provider? To give it an approximate location (the one from the network provider), so it can find my location faster?
I think that google maps made some kind of optimisation, because their app finds my location faster than my basic app, that only register to the gps provider.
Any idea how I could accelerate the process of obtaining my location with decent accuracy ( <30 m) ?
You are right that if you move a long way with the phone switched off, then it can take a long time to get a satellite fix. This is where AGPS helps. The 'A' stands for 'assisted' which is very much carrier and handset dependent in its implementation. In essence it gets an approximate location from cell towers or from public WiFi like coffee shops and then downloads ephemeris and almanac data which tell the phone which satellites are likely to be overhead at that time in that rough location. The phone can then start listening on the frequencies corresponding to the visible satellites first. This should speed up the time to first fix.
Common practice is to use WiFi SSIDs or the location of the cell tower you're registered with to look up your current location via providers like WeFi or Skyhook. Google uses its own service for that (and sees that no one else does).
Another method would be, in case your smartphone has a barometer, to look up the air pressure and try to pin it down to a location. While all these methods can theoretically be used offline, it is easier to fetch the data from the internet.
Also note that inaccurate NTP settings on the phones may lead to longer GPS search times.
Is there a way to help the gps provider?
NickT has answered this, but the android phone has to call the AGPS. In your app you cannot controll that.
I think that google maps made some kind of optimisation, because their
app finds my location faster than my basic app, that only register to
the gps provider.
This should not be the case, probaly you are doing something wrong, or the google app can enable assisted GPS. Try to compare with other android GPS apps (e.g compare with Motion-X-GPS)
it could take up to 10 min until the first onLocationChanged call.
Normally this is far too long, either your phone is known to have a weak GPS quality, or the device did not have free view to open sky. Even without assisted GPS, after 45 seconds, you should have a valid GPS position (asuming free view to open sky).
But this situation can happen, either the first time you use GPS on your device, or when you fly by airplane to a location far away to your last GPS position.
On my iphone i rarly saw such a situation when another GPS app was somehow disturbing, after a reboot of the device the GPS was immedeatly valid.
Again check if it is the fault of your app, by comparing if other apps needs 10 minutes too. (It could be your fault, when you wait to recieve an accuracy <30m while other apps would take the first valid position they get.
If google needs 10 minutes, too, then you could do nothing on that phone, except to expose it to good view to sky.
(Inside an urban canyon it's more difficult to obtain a valid first fix, then on an big place.)
Is it possible to create a GPS application using Google Maps to locate the position of items. To do this, I think that the process would be to attatch a GPS transmiting device to an item (such as car keys or sun glasses) and if you lose them, their position can be located.
I have developed some Android Cell Phone applications and would want to make the application to locate the devices for the cell phone market.
For this situation, what would be the best transmitting device to get?
When I misplace my sunglasses, keys, or something they usually end up somewhere out of a line of sight to the satellites ... Thus, even if these items had a GPS receiver they would not be able to get a fix.
Additionally those items need to be able to communicate their location to your device or the internet. And those items need a power source to operate the GPS (and the communication device).
In my opinion, for indoor lost item it would be better to use some signal form the items and then home in on the signal (bluetooth, wifi, whatever). This also needs less power than GPS.