LocationSensor Extension. Accuracy. Geocoder. GeomagneticField

Hello friends,

this Extension is about:

1.- SensorLocation.

  • It uses the classes:

https://developer.android.com/reference/android/location/LocationManager.html

https://developer.android.com/reference/android/location/Location

In those pages you can find information about:
getLatitude, getLongitude, getAltitude, getSpeed ​​(m/s), bearing, bearingTo, distanceTo, getTime and convert.

bearingTo and distanceTo refers to the Properties: LatitudeTo and LongitudeTo.

Bearing: https://en.wikipedia.org/wiki/Bearing_(navigation)
Bearing online: https://www.sunearthtools.com/tools/distance.php

2.- Geocoder.

Blocks: getFromLocation and getFromLocationName

Gets:
adminArea, countryCode, countryName, feature, locality, phone, postalCode, premises, subAdmin, subLocality, subThoroughfare, thoroughfare, url

  • It uses the classes:

https://developer.android.com/reference/android/location/Address

https://developer.android.com/reference/android/location/Geocoder

3.- GeomagneticField.

Gets:
declination, fieldStrength, horizontalStrength, inclination, x, y, z

  • It uses the classes:

https://developer.android.com/reference/android/hardware/GeomagneticField

Read:
https://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml

Earth’s Magnetic North Pole Has Officially Moved (Toward Russia):
https://www.forbes.com/sites/trevornace/2019/12/17/earths-magnetic-north-pole-has-officially-moved-toward-russia/#7688ea47201f

4.- This app uses LocationSensor Extension (black text) and LocationSensor of MIT App Inventor (blue text).

On the Map Screen, the coordinates of the red dot are obtained with the Extension and those of the blue dot with MIT App Inventor.

p185C_sensorlocalizacion.aia (33.5 KB)

You can download the com.KIO4_LocationSensor.aix extension of:
http://kio4.com/appinventor/285C_extension_sensor_localizacion.htm

Regards,
Juan Antonio Villalpando.
http://kio4.com/appinventor/index.htm#extensiones

8 Likes

With Kodular you can also use Google Maps:

Hi Juan,

I’ve made a test with your extension because I try to get centimeter accuracy for some applications. The number of digits provided by AI2 when you get latitude/longitude gives you an accuracy of 10 meters witch is not enought in some cases.
My problem is that using it I don’t get more digits and also no information about accuracy (this information is available in the GST NMEA message)
Do you have any idea ?

Hello Bertrand,

I have published two extensions about GPS:

in both I obtain a value of latitude and longitude with 5 decimals and an accuracy of approximately 3 … 5 meters.
I think that the accuracy of centimeters can be obtained with Galileo satellites, but I have not used that technology.

1 Like

Hi Juan,

In fact you can get something like less than one meter accuracy with the new dual frequency GNSS chipsets that you have in Samsung Snapdragon or Xiami Mi8 and +

You can also get 1cm accuracy on your smartphone if you connect the external Trimble Catalyst antenna…
Applications are endless…

@Juan_Antonio
Is there a way to get also the $GST NMEA message (location accuracy) ?
Are your extensions published on the MIT extension repository ? It’s not clear on your website witch one is the latest one.
I’ve made a test but it doen’t work. Do you seesomething wrong in my blocs ?
Thank you

Try this
Nmea_30.aia (15.6 KB)

I can get GN—, but not GP—

Look what I have with the Nmea_30 program

Juan your extension and example are super.
it compares very well to my garmin Vista
great job

thanks
erhard

  • Information about Galileo (GPS in Europe).

Galileo’s capabilities have grown with the addition of a new High Accuracy Service, freely available worldwide to anyone with a suitably equipped receiver. Delivering horizontal accuracy down to 20 cm and vertical accuracy of 40 cm,

https://www.esa.int/Applications/Navigation/New_Galileo_service_set_to_deliver_20_cm_accuracy

https://www.usegalileo.eu/ES/inner.html#data=smartphone

https://play.google.com/store/apps/details?id=com.android.gpstest

2 Likes

I am using the KIO4 location sensor in a couple of different apps. It behaves differently in the two apps. I have compared and I cannot see any difference. There is an simple and interesting work around.

Simply my KIO4 LocationChanged routine only runs every 30 to 60 seconds. It is random and it does this while driving and the app is running.

In a sister app that I wrote, albeit 1% of the total code in the big nonworking app, it works perfectly. Here is the interesting point. If I run both apps in parallel, or I run google maps in parallel the big app works just fine and with acceptable results.

I see a setting to set update rate in the default location sensor, but not in the KIO4. I tried using the dummy routine with the default location sensor and it did not help.

Is there a way force the update at the proper time, or at least more frequent.

That running Google Maps on your device simultaneously with the App Inventor Maps/LocationSensor improves location accuracy has been known for quite a while (since Sept. 2023) . The following link attempts to explain why there is an improvement Google Maps and the Location Sensor (running simultaneously to achieve better Accuracy) - #2 by SteveJG

More explanation: GPS location Accuracy - #2 by SteveJG