Humour me, and try this:
GeoLoc.aia (71.0 KB)
(uses html5 geolocation)
To uskiara san,
I think if this my application has no error, this application must report updated position regardless long stay same place,
Maybe Appinventor2 helps us user to satisfy our object.
If it has some limitation that should be clear to user.
Why shall I use some extension?
I believe this must be solved within AppInventor2 function,
If device has cause of this problem, there is no problem in AppInventor2.
Dear @shigeki_suzuki san,
MIT AI2 isn't only a programming language, but is a Community, therefore anyone who is capable to contribute in empowering it, he/she can do by creating extensions and making them available to the community.
I didn't said that your code is wrong, my hint was simply referred to help in finding where is the root cause of the issue: by using the NMEA extension, you could have verified whether it is the device that isn't updating the position (but I believe not, since gmaps works immediately), or there is a lag in the LocationSensor component.
I also have given you some other hints about the use of the Location Sensor itself, related to its timings, accuracy and threshold distance: those setting are working perfectly on my car and on my historical rally car.
I just wanted to share what is working for me, with the aim at helping you to solve (or to bypass) the issue.
Best wishes for your project.
Kind regards.
EDIT
I've just had a look to your .aia and the following is what I have some doubts about:
in the designer page you set the TextBox1.text to 600 and in the blocks page you initialize the clock1 timer interval to textBox1.text *1000.This leads to a clock1 period of 600000 milliseconds if you don't change textbox1.text before hitting button1. In addition, please be aware that the settings "timer always fires" causes the clock1 to fire even if the screen1 is not shown, therefore when screen2 or screen3 are shown instead, the firing of clock1 can cause problems (i.e. access to UI components not available at that moment).
Because it might work that way, and AI2 cannot know the extent to which device manufacturers interfere with their devices' power-saving options.
So give my APK a try and let me know if it works on your device. I’ve successfully tested it on Android 13 and 16.
You may also want to try this:
I don't think that will help. A foreground service shouldn't have any impact on the LocationSensor, as the sensor independently determines whether to continue providing data during prolonged periods of inactivity (lack of movement).
But my test app (extension) should work.
To everybody concerns this issue,
I want to know this problem, that is Staying at same location makes application developed AppInventor and using Locationsensor, to stop to report correct position, is not common to Appinventor users,
If it is common, I want to the expert to improve AppInventor structure,
If it is not common, I must give up limit of my application..
I must use only the block Locationsensor,locationchanged.
On my old android 10 phone your app seems working ok ( with clock interval set to 60s and location interval to 6s ):
Noticed that the ProviderName is always “gps”
To everyone,
Today I found another important observation.
Simply closing and reopening the app does not refresh the location. The app still starts with the old parking position.
However, after powering off the phone completely and turning it on again, the app immediately reports the correct current location.
This makes me think the stale location may be stored by Android's location service rather than by my app.
Did you remove the app from recent?