Hello,
I actually have a problem using LocationSensor : the app I made is like trying to calculate my location forever but seems to fail !
I use labels to show the latitude, longitude and altitude, a map and a marker to show my current location. Here are screenshots from the blocks and the properties of the map and of the location sensor components.
When I try my app with AI Companion or installing the APK, it doesn't work at all ! The map and markers never show my location ! I don't understand.
Can anyone help me please ?
Hello, I just figured out the problem : it seems to don't work when I use the gps whereas it works perfectly if I set the providerName to network so it uses Wi Fi and 4G of the phone. But I will do look at your linked project. Hoping the gps will work with your helpful tips because if you are on a top of a mountain with no 4G... The gps must work ! thanks. Augustin
The LocationSensor and gps will always work (they do not require a wifi or network connection to provided geocoordinates; they use your device gps receiver and will work on a top of a mountain). The Map, however is dependent on either WIFI or network . It can only render if you have an internet connection. (Actually an app using Map will cache OpenStreetMap tiles for areas you have 'visited' and render an image but not always a quality map image).
Good luck.
To understand how this stuff, please read Using the Location Sensor if you have not already done so.
Yeah I know that but I tried your VerySimpleMap and that also doesn't work ! Keeping the app opened during 5 minutes, it doesn't find a satellite. Either I don't have any satellite where I am (that seems strange) or... Idk. Google maps successfully locate me if I disable WiFi/network after 30 seconds. So it's strange...
Did you read and try the tutorials in post #3 and do the two tutorials in the Using the Location Sensor link? There are always satellites every where on earth, even in the French Alps. Did either of the two examples shown there work? Living in a mountain valley can give a gps receiver issues (because the mountains will block some satellites, however you say
It is possible that Google maps is either using cell tower information to provide a location instead of the gps or your Android is defaulting to WIFI. Can you explain what you mean by 'disable WiFI/network after 30 seconds'? What happens if you use the Google Navigate app? Does it locate you properly?
So, I'm using Android 11.1 (last release). As you can see in the video I made, I first disable Wi-FI search localisation and then I locate me with Google using only the gps and it works !
Sorry you still cannot get the gps App Inventor app to work. I have never seen this problem reported before. What do you see on your Android screen when you run the app?...what happens when the app fails (anything you can describe Augustin?). Did you test the app outside?
Be aware, it might take 30 to 60 seconds for the gps to aquire a satellite fix so it could be that long before you get coordinates and a map image.
Since the app is failing on an Android 11.1 I expect the problem might be a permissions issue. Sorry, I cannot test only having an Android 8.1.
.. @TIMAI2 ..can you help test this on an Android 11? If the app does not run on an Android 11 the missing required code to make it work might look something like:
Thank you for being persistent and posting your results. Glad we discovered the issue by working together with Taifun's hints. Congratulations. The main issue was getting outside.
Regarding altitude, what you experience is normal
...from the location sensor tutorial
Altitude
The units is meters. The altitude is the altitude above the WGS84 reference ellipsoid, not the elevation above mean sea level. Altitude from a GPS is terribly inaccurate, even for expensive GPS receivers. Read about altitude determination here: http://gpsinformation.net/main/altitude.htm. Altitude is very unreliable on most GPS receivers, not only those embedded in phones and tablets. Altitude reported on a phone/tablet can easily be off by +/- 30 meters or more!