AndroidWheresMyCar

Hello everyone, basically in this tutorial that I followed years ago; I can no longer get my current position to load via GPS :upside_down_face:

Regards
Nicola

Tutorial_MIT_AndroidWheresMyCar__LocationSensor_TinyDB_ActivityStarter.aia (405.2 KB)

Does your App have the permission for it? I thought sth changed about in the last couple of years….
(Sorry if it is a dumb question)

Honestly, two years ago it worked perfectly, now if permits are needed, I don't know.

@Nicola_Imperati

The aia you posted works in my Android 13 and provides current position correctly when using Companion 2.72. The gps part works fine.

However, the splash screen image is not working properly and I ignored it.

@SteveJG

Just now I tried to use this app again via the companion. At first it still didn't work, but after repeated attempts to save my position; finally it managed to hook up to the GPS. P.s: The problem was not due to its malfunction; but to the fact that I was the one who expected the GPS to hook up instantly :wink:.. anyway my operating system is Android 11.

Android 11 is when Google introduced the concept of 'fused' provider. The app is selecting the Provider using Google's criteria whether to use cell phone tower or network data (WIFI) or the gps hardware to provide the location. When it does this it might be ignoring the LocationChanged block.

The app, written several years before the introduction of Android 11, should not be able save your current location unless the LocationSensor/gps hardware has a satellite fix or determines its coordinates. (You said previously that you 'can no longer get my current position) The LocationChanged block is supposed to prevent saving the location until the LocationSensor has determined that it provides the current latitude and longitude. The existing code seems to set the RememberButton.Enabled to true before it has a set of coordinates.

The if statement shown in the modified code I show here might allow the code to work correctly. It tries to make sure the button can not be pressed until proper coordinates are determined. It might remember for you to wait until coordinates exist. Coordinates are not available instantly. The app needs the correct data to save.

Glad your app is now working correctly.

if you want to use GPS, then follow thee suggestions

Taifun

A few years ago I created an app to eventually be able to share my location via WhatsApp or via SMS with some contact on my list (including to register the location for myself). It was one of my first projects while I learned AI2. I faced the problem of the 'delay' of the sensor... and the way found was to leave a message 'Wait' displayed on the screen that would only be changed after the latitude and longitude coordinates had finally read.

Perhaps you can enjoy this project to some of your needs and to understand how to deal with the sensor delay. :pray:

Precise_Location_Enhanced_OK.aia (13.9 KB)

Lito

@>-->---

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.