Using a GPS app I find that inside a car I get maybe 3 satellites with low quality signals. The GPS never locks and so nothing that requires GPS will work. The GPS app says that it gets 0 feet accuracy which means that an app that requires GPS would never be notified of a successful GPS signal.
In an app is there any way to get very rough GPS information when the signal quality is low? The app I'm writing would work very well if all I could do is get a rough speed and direction. I don't need pinpoint information.
I know I can use cell signals for location information, but that information is useless for getting speed and direction. I can't find any example code for using the accelerometer to get rough information, but even if I did it would only work if the app was started when the car was stopped (so it could detect the acceleration).
If I could get a very rough signal I should be able to calculate speed and direction, yet there doesn't seem to be a way to register a listener for that.
To get speed only GPS_PROVIDER can help. All you can do is to set minTime as well as minDistance to 0. i.e. requestLocationUpdates (LocationManager.GPS_PROVIDER, 0, 0, listener) Do not put any criterias. This will make best use of GPS hardware chip inside your android. This would however drain battery much faster. I had observed that after getting 1st GPS fix even if you move a little inside of room, the flow of GPS updates still continues, where it would otherwise never would able to get a fix. Regarding of getting direction while in motion, if you know the position of device inside car, you could consider of keeping track of accelerometer readings, and with the help of orientation listener check on which axis you get the jerks more, then this will give you the direction of motion.
Technically, if you can get an okay signal from 3 satellites, you can get a fix. I'm not sure if such a low-quality fix is enabled on Android or not, but it is possible.
Regarding the accelerometer, it is not accurate enough to get an idea of direction. You will find too much noise, if anything from vibration.
Perhaps you should interface with a bluetooth GPS on top of the vehicle.
I'm not aware of any way to get a 'low quality' signal. In my own app I've noticed that GPS normally receives its first fix once I have 6-7+ satellites but this could vary (I've never seen a fix with only 3).
You really can't determine if you have a fix based on how many satellites are connected to.
I think you need four satellites to get a proper GPS reading (one for each variable in the GPS equation), but many of the Android devices on the market have access to the magnetometer. If you calibrate it (waving in a figure-8 for 4 or 5 cycles), you can get a pretty accurate direction determination using the "compass".
Other than using the GPS, I don't know of any technique of calculating speed.
Related
I am in need to develop an android app where the device will track the distance traveled while the user is in a moving vehicle. I am getting the GPS values at small interval so that I can retrieve the distance and sum them up. But the problem I am facing is, while the user is in the vehicle, the device is not getting a clear view of the sky. Hence, the GPS device cannot get values as frequently as I desire. Thus, the result produced contains huge fluctuations. I tried using the network provider, but that is even worse in this scenario.
It would be very much helpful if anyone can suggest me a solution to this problem.
Just put the receiver onto the inner side of the windshield, like all navigation systems do. This should give an acuracy of about 3-6m. (when SBAS correction is available in your location) or up to 10m if not.
If the receiver is not state of the art (combined GPS + GLONASS or BEIDOU) then you will have problem in cities, especially in urban canyons with location jumps up to 30m.
This is normal. To get correct result for a GPS application within a city you need advanced algorithms. Just summing up the distance between two consecutive locations is to primitive, this never works well. Distance calculation by GPS has be answered some times her at SO. Use the search engine, to get more info at that topic.
Of course, set the device to GPS provider only, with maximum precision.
I've ran into a little problem and I don't feel like I'm informed enough to overcome the hurdle.
In essence, I'd like to figure out whether someone is moving over a threshold of say, 40 kmh (~25mph). I get GPS coordinates at designated intervals and compare the distances, which all works fine.
My question is, which method of getting GPS coordinates would work best for this application? Using the Network, using GPS, or both (like, check if the network is connected, else use GPS)?
The summary is, which is the most accurate method?
I'd use the fused location api in this case. In addition, if you want to know if someone is moving you could use the activity recognition of google play services, it requires much less effort and you can even filter by activity: only with car for example (if you want to track over the 40km/h it's unlikely someone is moving on feet).
i wrote an app, that tracks the gps location while jogging. Unfortunately the app needs some time to get a gps signal. When i open other apps like google maps, they are getting immediately the position.
My Problem is: How to implement the gps-provider, so that the app gets as fast as possible a signal.
One idea was, to start a service with the app, so that the provider does some preliminary work. But the tracking-activity is not the main-activity. How can i bind the service in an activity, that does not have started the service? Is this a good idea?
Thanks for reading - and i hope my english is understandable,
Martini
As I mentioned in my comments, GPS start up is not an instant process. The receiver basically has to know the position of each of the GPS satellites in the constellation in order to calculate it's location. The ephemeris data describes the positions of the satellites to the received and is downloaded from the satellites when the GPS is turned on (and I almost forgot to mention the almanac data, which is also part of the download and describes the orbits of the satellites). Things like downloading from multiple satellites and using the last known position can help speed up this initial process, but you cannot make it "instant".
There are other strategies that can be used to help speed up the location process, especially in cell phones. In addition to the last-known position, things like Cell Tower + Timing positioning (ECID) or Wi-Fi positioning can be used in place of GPS while the GPS is still in the acquisition process.
This link describes some ideas on how to handle locating a mobile phone in android, but the short of it is:
check last known position (discard if it is too old)
check E-CID position (this is extremely fast, but is a very coarse
location)
check Wi-Fi position (this can be extremely accurate, but requires WiFi to be on and can sometimes have a large amount of error)
finally obtain GPS position
Are you first checking if there is a last known location which you can use? Most apps first check for it and then search for a location.
I am using GPS to fetch location at 15 second interval in my android application. It is giving correct data but sometimes it fetches forward location and after that again fetches backward location. In result i am getting wrong track on google map.
Please help.
Your question is a little big vague...
The problem with GPS is that it is highly dependent on your whereabouts. Things such as tall buildings and sometimes even large trees can have a major impact on your GPS readings. Being inside a structure or outside is also another major factor which must be considered. Also, most of the time, the GPS will return different GPS co-ordinates even if you stay in the same place.
The average margin of error of a GPS usually varies between 5 and 50m. When you say 'forward' and 'backward' location, I am assuming that you mean that the GPS is returning a value for a position which is either ahead of you or behind you.
The fact that, as you say, the GPS most of the time works, leads me to suspect that the issue you are experiencing varies depending on your actual physical location, however, due to the vague nature of your question we can only speculate...
My suggestion is that you try this out in various places, maybe some with clear access to the sky, and another in a crowded area and you see how the GPS behaves.
I too faced same problem while testing my Google navigation app.
The wrong location from GPS receiver is due to the lack of signal reception from GPS Satellites to GPS receiver.
This is due to the position of your GPS receiver device and also depends on the quality of GPS receiver.
Right now, I only know of one method to do this:
- Get last known location
- Have the location manager request location updates
However, I really only need to get the CURRENT coordinates ONCE right when the application is called, but it's not doing what I want.
What's the simplest way to get the current coordinates? Is there something I could call or some code I could use just to get the location RIGHT NOW ?
thanks in advance! I'm still a little new with android development.
What's the simplest way to get the current coordinates?
There is no way to get the current coordinates on demand.
Is there something I could call or some code I could use just to get the location RIGHT NOW ?
No, for three related reasons:
Not all location technologies are low power. GPS, for example, is a serious battery hog. Hence, GPS is not powered on unless something is actively seeking a GPS fix.
Not all location technologies are instantaneous. GPS, for example, takes some number of seconds to get a fix after being powered on.
No location technology is universally available. GPS, for example, may be unavailable because you are in a large building.