How to find the altitude of a location? - android

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();

Related

Android GPS FusedLocationProviderClient : wrong longitude

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...

Android some time my code give not accurate distance in android?

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?

Is Android location apis' full-proof?

I had a strange encounter once: The location on the phone's map application and even my application was wrong by a very large delta. As in it was quite off the actual location. Is it something many have encountered or some bug with my device ? What is the approx probability of this happening (from those who have tested this bug) ?
I am using a Samsung Galaxy SII with ICS and my application fetches info from GPS_PROVIDER.
You might have an encountered a cached location if the maps application couldn't get a fix on your current location. For getting up to date locations in you app take a look at this question here
It's pretty normal for my location to be off by a large amount for a few seconds after a device turns on, until the radios can get a fix.
I have seen errors of more than 10000 km. I was looking at network fixes which come from cells and wifi only, no gps. The fix put me in England (UK) somewhere even though I was at an outlet mall in California (US). My guess is that someone had moved their wifi server from England to California and the Google WiFi database had not updated itself yet. I had a few more errors like that but not as spectacular, only 1000-5000 km reporting locations in other states of the US.
Network fixes based on cell towers will usually be 1 km off and are often 10 km off. These are based on the cell tower seen by the phone, and in hilly terrain you can often miss the closest cell tower and grab one that is on a high location a few km away.
GPS fixes also can have errors, but usually less than 1 km. These errors mostly come when some GPS signals are blocked by hills or buildings or reflected off nearby hills or buildings.
I have seen all of the above when testing Android phone positioning. Not all phones will behave identically, the quality of the GPS implementation (chip choice, rf design) can make big differences in performance.

Does Location.getSpeed() work?

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.

unable to get current location on SonyEricsson X10i

I am using SonyEricsson X10i phone. I have developend an application that just shows the current location of a user. Now the problem is When i turn on my application it just keep searching. It is not showing anything. Even if i try to use built in navigation system it does not work. I have turned on GPS receiver. My firmware version is 1.6 and kernel version is 2.6. I am not sure but i came to know from some resource that 1.6 firmware does not support GPS. Let me know if someone knows the solution.
Are you indoor or outdoor? GPS
usually only works well outdoor.
Do you
have turned 'network' as a data
source on in your location settings?
Allowing triangulation/cell
towers/wifi networks to get the
location if GPS/satellite is not
available.

Categories

Resources