I've seen alot of question stating that getSpeed() returns 0.0 but does it actually work? Or does hasSpeed() always return false or is it just for certain phones?
Yes, it does work with at least with GPS and on those devices I used up to now (mostly HTC and Samsung).
You will not get a speed in the emulator if you are providing single locations. Even when I provided NMEA data streams to the emulator the speed was 0.0. But it works fine on the real device.
Related
We have a ReactNative app, running on both iOS and Android.
We developed our own native module for GPS updates.
On iOS, it's working OK !
On Android, we're using FusedLocationProviderClient.
My problem: in some very rare cases on android, less than a few % of our GPS data, we see GPS data with correct latitude, but longitude keeps jumping around the real one (e.g. this seems to happen on some Samsung S9+)
See this screenshot
This bug only last a few minutes, then seems to resolve on its own...
Has anyone encoutered this bug too ?
If so, how did you fix it ?
(note: I can add code samples if you think it can help, but I'm having big difficulties reproducing this bug myself, so I doubt it's useful in this case...)
GPS takes awhile to lock, and depending on the phone, it can take quite awhile and be unreliable. The best thing you can do is check the accuracy that is reported, and also live poll the user's location when they open a relevant activity so by the time you need the location, it most likely has an accurate lock.
Also if needed, ask the user to apply their highest location accuracy settings. Details on how to do this can be found here
GPS takes some time to latch, and there should be at least 3 satellites to be able to latch for the device, if the user is indoor, it is nearly impossible to latch.
You will have to check for the accuracy, on testing I have found that if accuracy value becomes 2.9 (may be different on different devices, but till now I haven't seen) then your device location is set.
Or give some time to devise and record coordinates when you think it's feasible depending upon accuracy.
Hope this may help you...
I have android app in which i am getting distance travelled speed and time some time the app works fine but sometime the app does not give accurate result i am using fused API in locationService class. any suggestions are welcomed.
Thanks
I'm assuming you're using a real android phone on your test and your code is 100% correct maybe the problem might be with the device itself. Have you turned gps high accuracy on? Have you tested your application with another phone?
I have a GPS logger app I have wanted to make for a few years now. My old phone could never do it (HTC Desire Bravo A8183) as the GPS update rate was only 1Hz. Friends are telling me their Samsung and iPhones can do 5Hz GPS now. I have installed the same app I used in my HTC in my Nexus 5 to measure the GPS update rate and I am still getting 1Hz as the standard update rate from the Nexus 5.
At first all I want to make is a position recorder that saves GPS coordinates to the onboard storage. For this application power use does not matter, as using a USB car charger at the same time would make sense. It also does not matter if the 'phone' functionality of the device is impaired whilst the app is running.
My idea is to make something for personal use similar to a GoPro with inbuilt GPS logging. GPS would give you location, and distance over time gives you speed, and delta speed over time knowing weight and drag co-efficient gives you horsepower. I already know the Cd and CdA and running weight for my race car.
Anyway how do I get the phone to poll the GPS more often? Do I need to root kit the phone and then install some obscure hack? Or is it not possible?
I need accurate data in the 4-10Hz range or I may as well just forget about making this. I'm pretty sure I can buy a bluetooth GPS 'mouse' that does this but it would be much more practical to use the phones internal hardware.
I am using Location class to find latitude,longitude and altitude. But I am always getting 0.0 for altitude. I have tried running the application in both emulator and real android device but still I am getting 0.0
It seems like a lot of people are having similar issues with this and has even been reported as a possible bug. I wouldn't be surprised if the emulator simply doesn't support it at this time. You'll probably have to work with a real device.
On real device check this...
locationProvider.hasAltitude();
We are testing out Android application on real world devices and notice some of them report very unaccurate data (even under clear sky and over 10 sats seen and 5 sats used), and even reporting speed over 10km/h when the device is not actually moving, and at the same time some devices retun 0 when location.getAccuracy is called.
We have managed to parse NMEA data, and NMEA reports "1" which means that the data is reliable.
This sometimes happens to different makes and models based on different hardware and different Android version. The most unreliable are S-E Xperia x8 (sometimes we get fixes at 20-30kms from real location) and Alcatel 918D (it is always moving over 5km/h and accuracy==0)
Turning A-GPS helper off and on as well as clearing/re-requesting A-GPS updates does not help.
Is there any way to filter such unaccurate fixes "by hand" (with some other NMEA stanzas, etc.) becuase some other software report the location much better on the same devices?
P.S. On most devices we get fine results, as expected.
P.P.S. The most accurate is my own Garmin-Asus. Hope they join again someday.