Exploring with Location Sensor in AI2
The location sensor object is used to communicate with the global positioning satellite receiver (GPS) in your phone/tablet. When the LocationSensor communicates with the built-in GPS receiver, the GPS can determine the location of your device. The sensor can also work with network/wifi location services. Finding a location using the network uses very different techniques to determine a location. Location means, the device's present latitude and longitude or it can mean your street address.
Your simple app does not work for a variety of reasons:
1) You initially tried to find an exact latitude and longitude ...Scott explained why that does not work.
2) A property of the LocationSensor called Accuracy (explained in the tutorial). When you read the tutorial it explains that the GPS frequently does not know exactly where the Android is with any precision.
3) Your present code is an attempt to create a ring-fence; determining whether the device is within that fence is problematical. The app might not be working for a variety of reasons depending on how often you program the LS to get a satellite fix or you are located South or North of the equator or to the West or East of the Prime Meridian (that affects how you set up your logic blocks) ..and you obscured the most important part of your geocoordinates. Also, the TTS code might be creating an issue with timing...AI2 is event driven,
4) Other things can go wrong: Does your device have a GPS receiver? If it does not and you depend on network, Accuracy is terrible . Do you use the most accurate geolocation method Provider = gps and then lock it or do you use no settings and let the LS select what method it wants to use? Do you see the GPS icon flashing occassionally at the top of your device screen..that shows the GPS receiver is trying to obtain a satellite fix.
5) the GPS receiver itself in many devices is not very precise, unless you monitor Accuracy continually, you will never know whether the GPS has a poor or very good satellite fix.
When finished with the LS tutorial perhaps read and do this tutorial
The Maps 104 tutorial describes Accuracy in a different way than the LS tutorial.
There are several solutions to your original problem, knowing when you arrive at a particular location.
Solutions include:
2) Using the LS DistanceInterval property to determine how close your device is to a certain point (google the forum for a discussion that mentioned Halte Alarm ..Christophe solved his problem that way. DistanceInterval is discussed in the LS tutorial
3) Calculate the distance from the Android's current location to the desired location every minute or so, when the distance is small, you are there (the second tutorial demonstrates several ways to calculate distance). You will have to write code to poll the calculation.
5) When all else fails look at a paper map, phone the residents of the house and ask them if they see your Android outside perhaps?
Hope this helps Nico. When a developer realizes the GPS in phones is basically stupid, he/she can program around the device's limitations when he understands how the hardware and software tools work.
--
I have used the first option with the ring fence. It works but not perfect...
In the first picture i show wich coordinates i used. If this were the house i search and cross the street by the house the phone must be ring.
The black points are my coordinates...
Then i look wich coordinate is higher an place them into the field (second picture)
Must the fence be smaller?
--
It MAY work, but the problem is that you have a loop in your code. The code will make tts talk over and over again as long as you are in that are.
I have an app that will be releasing in the market next week with MANY gps features.
--
Without seeing the interval of your ring fence, I cannot comment as to whether the ring-fence should be smaller or not. See below-you will have to experiment with how small the box you monitor is to get the best results. From the points on the map, it appears the box is fairly small, possibly it actually needs to be larger ...experiment.
The area you are in has tall buildings. Using your GPS there is like using the GPS in a canyon. Buildings are probably preventing your GPS from getting a satellite fix with a lot of satellites. When very few satellites are used in a 'fix', the Accuracy value increases dramatically. It is easily possible your GPS reports a location that is as much as 50 meters away from where the GPS says it is. Are you monitoring the Accuracy? You read about it in the links provided. If you monitor accuracy, you can eliminate geocoordinate readings that are more than say 5 or 10 meters distant from the true location.
You read the LocationSensor tutorial, you recall that the metric way of looking at 0.00001 of a degree of latitude is that 0.00001 deg converts to 0.9144 meters. The measurement tells us, satellite positional information can be reported is to a precision of 0.9 meters. The satellites report positional data using five decimal place precision. Does this mean that when a GPS gets a fix on multiple satellites that the smallest distance resolved should be 0.9144 meters? No. For other reasons, the best accuracy possible with specialized GPS receivers is on the order of three meters.
Depending on how frequently you update the LocationSensor, Hossein's comment might be correct. The TTS can interfere with the LocationChanged depending on timings. I would put the TTS in a separate block that controls how often the LocationSensor is updated.
Is it possible to do what you want, getting the phone to vibrate or the TTS to speak. The high buildings means the Accuracy is going to probably be a large value.
--