What can you post and upload? This is a test

—can you post an image? a hyperlink? an aia file? oops Sorry, the file you are trying to upload is not authorized (authorized extensions: jpg, jpeg, png, gif). an apk file? :cry:

Geofence - using the MIT Map and Circle components to define a circular geofence by SteveJG

This example uses the Map, Circle and LocationSensor components to define whether the Android is inside a circle geofence of 8 meters radius or outside of the area.

The example app samples the device’s location every 30 seconds. Some GPS hardware might obtain updated satellite fixes more rapidly or others, with fewer receive channels, might require more time (most cell phones). Thirty seconds is hard coded. You can code a faster TimeInterval but the GPS will not update until it receives a different satellite fix. Unconvinced? Create a similar app using the AdvancedLocationExtension without the Map component. Sorry, the ALE does not work in conjunction with the MIT Map component. The ALE is able to show how frequently the Location updates. Small TimeIntervals seem to work in the LocationSensor, but despite the instruction to poll at the faster rate, the locations do not actually update that fast.

For purposes of this tutorial, the position of the target geofence circle on your map is determined by adding 0.00008 degrees to the actual device location as a demonstration. 0.00001 is about 1.11 meters . The example uses (a offset of the device location latitude and longitude for the circle’s location to demonstrate the principle. Use a fixed location in your app to place the circle geofence, Write your own code to be able to place it where you actually want it

Button1 (Check Status) forces a GPS update immediately (if possible).

The demonstration provides a notation about current GPS Accuracy property in meters. The distance to the target geofence circle (if the device is not within the geofence already) is calculated. It will report whether the device is within the geofence or not (inside/outside). An OpenStreetMap tile is shown at a zoom of 18 (so the app can show / resolve sufficient detail of the circle geofence (8 meter red circle) and the current GPS Accuracy circle (pale blue circle).

The best location resolution is obtainable with higher quality GPS receiver models. The more receive GPS channels available in the GPS hardware the better. The display image is from a Samsung A10 tablet. Most older and cell phone Android devices will not provide as good resolution. Resolution and best Accuracy (low numbers) depends on many factors (is it raining, is device is indoors in a steel frame building, is located in a city canyon where building obscure the view etc.

What is reasonable to expect from your GPS and app.

Can your Android find your geofenced area? Maybe. Whether it can determine whether you device is within or outside the bounds of the circle geofence depends on the size of the geofence circle, the setting of TimeInterval and how fast the Android is moving (in a moving car, carried while walking etc.)

Your Android may be traveling too fast to resolve the geofence. Traveling at 60 mph ( 88 feet/sec (26.8 meters/sec) you travel 264 feet ( about 80.5 meters) in 3 seconds at 60 mph. Be aware, 0.00001 degree of latitude is approximately 1.11 meters at the equator (3.6 feet) ( https://www.usna.edu/Users/oceano/pguth/md_help/html/approx_equivalents.htm )

. If your device travels at 60 mph, you blow through the 8 meter radius circle (16 m in diameter) geofence in less than a second. If you sample at each thirty seconds (a reasonable rate) then it is easy for your device to be outside of the circle at a sampling point and then the device may not sample again until you are on the other side of the geofence. You could try more rapid sampling rates but your GPS certainly will not refresh within a second.

It is difficult for your app and device to determine whether your device is within or outside of small areas (geofences) with any reliability. The example uses a Circle with a radius of 8 meters. Try a radius of 100 meters. You can, however monitor how close you are to the geofence (i.e. distance to the geofence from your present location) but only to the extent Accuracy is rather low values and sampling is sufficient to obtain valid location of the moving Android in relation to the frequency of sampling.


Your GPS really does not ‘know’ exactly where it is at any moment. The green circle is where the Android actually is, the other marker pins show where the LocationSensor (resting on a desk , reporting its location once a minute, thought the device was … occasionally over 50 meters away from the actual location.

A cell phone GPS cannot resolve better than within two meters; professional papers indicate most cell phones are capable of resolving about 5 m most of the time but often are only capable of resolving 30 m. The Accuracy is variable (it changes for each satellite fix) so when the LocationSensor posts a location, that location is only about 68 percent reliable. If you move too fast near or through a small circular geofence , the device might not notice the geofence circle. Consequently, small geofences cannot be reliable when used using a cell phone GPS with any guarantee of registering where one is inside or outside the geofence.

To test if your geofence works, remove the Blocks that show latitude / longitude plus 0.00008 degrees and replace them with the coordinates you really want. Then walk through it. Outside of the circle area will report outside and inside, well, you get the idea. Experiment. You can also set the Circle radius to 100 meters.and leave the other blocks alone… the app should tell you you are inside . Does it? Also experiment with the distance to the edge of the circle …using the distance. When you are within the Circle, the distance is 0, outside, it could be almost anything.

You can code this so that when distance is zero, you use the Sound component to produce a beep or use the TextToSpeech component to say you arrived, lucky your ring fence was large enough to register or something.


SteveJGCircleGeofence.aia (5.2 KB)


What is allowed has to be set by admins i guess. Everything is possible. Also what size is allowed. images, pdf, aia, apk are ok.

1 Like

Hi Peter
So aia is possible but they are obviously not allowed yet? Do we really want to allow apk’s ? apks are a security issue.

It seems moderators cannot yet even EDIT our own posts
The tools available so far are these Admin

ooops, sorry, I missed the pencil icon.

Keep in mind that we are still setting up the site. You may notice that the server has been around for 7 months. That is because I set it up way back then just to see how hard it would be to setup a Discourse server (it was called d.gornking.com then). When we decided to get serious, like yesterday, I renamed the server, updated the software and here we are…



I see in other builder forums apks being used. That is working ok. So far not many problems.

Not many problems. OK but why ask for trouble?

Hi @SteveJG

In other forums there are no troubles. The only thing that happens is that sometimes there is an earning app posted or something with copyrighted material. So it is deleted. No other problems.

understand works in progress Jeff. This is interesting stuff and this iteration is a test bed. :slight_smile:

I believe I have added “aia” to the allowed file extensions for upload. There is currently a limit of 4Mb on uploads. There are comments in the admin panel about having to also change a setting in nginx in order to increase it. I’m looking into how to do that now.



just edited the original post to include the aia. The aia’s now work…thank you.

1 Like

How do you test for malicious content in the apk Peter, other than loading an apk and getting burned? GooglePlay itself does this regularly with apps screen for distribution but does the Forum want to ever be a source of malware? Should the Forum be a software distribution site?

Like i said @SteveJG, in other forums we don’t see that a lot. 99,9% of what people post are safe apps or aia. The 0,01% is most of the time picked out by other users or by mods. Even Google isn’t 100% safe. Even aia-files can contain malware or paid extensions. We see that also in the forum. But these are also picked out. We try to learn visitors what is accepted and what not. So we see more and more users responding when they see something that is not following community rules. Makes my life as an MOD easier.

1 Like

Let's see if draggable blocks .png files
are importable from here ...


1 Like

My images were mashed together, and did
not survive a Blocks Editor dragging import attempt.

The Blocks Editor workspace flashed green and showed the + cursor,
but nothing arrived.

I will try and post the .png files as separate attachments instead
of inline images, if I can figure out how …


If you upload an image it is completely stripped of the code.

@ABG Unfortunately, Discourse does some processing to the images and it discards the unrequired chunks (e.g., the code chunk) even though it’s not supposed to per the spec. It’s possible we would be able to fix this but I’m not sure how much effort it would take.


That's a shame.

No improvement over Google Groups there.
Will have to supply github links

And when you link an image from an outside source, Discourse puts it on his own server.