0

I use in my app TLocationSensor on Android but I have a problem with Distance property. If I set 10 meters and I don't move OnLocationChange is fired.

What should I set and how to make it work ?

Sir Rufo
  • 18,395
  • 2
  • 39
  • 73
user2986634
  • 15
  • 1
  • 6
  • what is value of `LocationSensor.Accuracy` ? Launch some program capable of showing GPS information - what the GPS resolution does it show ? – Arioch 'The Jan 05 '14 at 22:15
  • What the GPS resolution is ? – user2986634 Jan 05 '14 at 22:21
  • What were values of `OldLocation, NewLocation` inside the event in different event calls ? were they exactly the same or really had 10 metres of difference ? – Arioch 'The Jan 05 '14 at 22:22
  • The resolution that the chip in the phone can calculate its position, depending how many NavStar or GloNaSS satellites it can see. For example in this program this information can be seen under "Tools" menu: https://play.google.com/store/apps/details?id=com.mapfactor.navigator – Arioch 'The Jan 05 '14 at 22:25
  • I set 10 meters for property distance and I don't move .... event was fired ... I found function which calculate distance beetween to points and I Added it to Onchanegolocation and It works... but I thought that it should works using this property or I missed something... – user2986634 Jan 05 '14 at 22:25
  • I will check it the program... – user2986634 Jan 05 '14 at 22:26
  • are your sure you device (which?) reads enough many of satellites to really know its accuracy better than 10 metres? In open places that usually is true, but inside city buildings, built of reinforced concrete, GPS receiption usually is very bad. // that program also shows what is the source of location information, maybe your device fail to connect to GPS satellites at all. Really, that is why I asked about accuracy and about actual coordinates reported to you in consecutive calls of the event. Or maybe something changes the value of .Active for sensor (just a blind guess) ? – Arioch 'The Jan 05 '14 at 22:28
  • What is a enough amount of satellites ? – user2986634 Jan 05 '14 at 22:31
  • That depends upon accuracy. Usually 3-5 satellites can give a very rough inaccurate idea where you are, and 8-12 of those allows to calculate all 3 coordinates with the accuracy about 3-5 metres. Many GPS programs show all those numbers ready to be read. I believe you can find more certain numbers if really need them in Wikipedia articles about NavStar and GloNaSS. PS the environment also matters, in the cities with all those buildings the signal may have multiple reflections from the sky to the phone, which somewhat distort it. – Arioch 'The Jan 05 '14 at 22:35
  • How should i set property accuracy ? – user2986634 Jan 05 '14 at 22:38
  • 1
    @user2986634: Arioch'The is quite right. You might take a look at this http://gis.stackexchange.com/questions/43617/what-is-the-maximum-theoretical-accuracy-of-gps/43657#43657 if you haven't already and note that "resolution" <> accuracy (I mean, in physics terms). – MartynA Jan 05 '14 at 22:38
  • @user2986634 you cannot - it is the integral estimation what can you current device do, in the current place under current network conditions. And also when your programs runs under current permissions (mentioned at http://docwiki.embarcadero.com/RADStudio/XE5/en/Mobile_Tutorial:_Using_Location_Sensors_(iOS_and_Android) ) – Arioch 'The Jan 05 '14 at 22:40
  • @MartyinA I suspect his device has no GPS at all, or it is turned off, or it is disabled for the application, which makes application play guesswork over the internet-provider last used external outlet IP and over coordinates of last used GSM tower. Since both those can change any moment, that can result into perceived "jumping" between 2-3 close locations. That is why I asked all those values, that the topicstarter does conseal :-/ Also I asked him to check the GPS Info window in the program known to work, so you'd see if it is Delphi that fails getting exact coords, or the device do. – Arioch 'The Jan 05 '14 at 22:43
  • I'm installing program to answer your question :) I have permission and gps was on :) Icon on my device show it :) – user2986634 Jan 05 '14 at 22:46
  • I have only 4-6 satellites in my building so it is the answer... I think ?? – user2986634 Jan 05 '14 at 22:53
  • @MartynA a very interesting even if somewhat pessimistic link. Also referenced there was http://gis.stackexchange.com/questions/12011 which is also very insightful. – Arioch 'The Jan 05 '14 at 22:57
  • In that window Navigator program also shows estimated accuracy in metres. Or you just can zoom the map and watch for about hour if the location "jumps". Or use its "track recording" function, then put a phone for few hours AC-charging (GPS calculations do consume battery) and later see how large was the pseudo-movements. PS. for what I remember, satellites with numbers 1 till 60 are NavStar, above those are GloNaSS. It is important how many satellites of the same system you have. – Arioch 'The Jan 05 '14 at 22:59
  • Thank you for your time and answers...I didn't know that event is fired when gps signal is not enough. – user2986634 Jan 05 '14 at 23:01
  • if the device reports to Delphi "jumping" locations, then what can Delphi do ? And the devices have really limited possibilities. – Arioch 'The Jan 05 '14 at 23:02
  • I think that is why Android allows you to set fake fixed locations in Developers Debugging Options menu. Very few programmers do their job under clear skies :-D – Arioch 'The Jan 05 '14 at 23:06
  • Yes, You have right :) probably no one :) – user2986634 Jan 05 '14 at 23:07

1 Answers1

1

Probably the XE5's location sensor component does work - it is just the device incapable of providing Delphi accurate enough data under given circumstances.

You can take some mapping software like MapSoft Navigator and record a track for few hours. If that track would show the significant deviations, then it means the device thinks it is being sporadically moved. And it reports those movements to Delphi, which triggers the events.

See the data presumably gathered under open skies, even without reinforced concrete walls making reflections and distortions: https://gis.stackexchange.com/questions/12011

Community
  • 1
  • 1
Arioch 'The
  • 15,799
  • 35
  • 62