The Map.PanTo component freezes and blocks the app if the mobile network signal is lost, and remains stuck until the signal returns. This makes the component unusable, since the marked route on the map could still be followed even without loaded map tiles. Positioning (centering on location) should always work. A timeout mechanism would be needed so that PanTo can continue even if the tiles are unavailable.
Expected Behavior:
PanTo should always work for positioning/centering on location, regardless of map tile availability.
If tiles cannot be loaded due to network loss, the component should skip them or apply a timeout and continue.
Actual Behavior:
When the mobile network signal is lost, PanTo hangs indefinitely.
PanTo has, since the arrival of the map component, shown some reluctance to "fall in line", and pan to...
Sometimes it will work, other times not so. For more reliability, we find other methods.
Your issue with loss of network will affect any AI2 components that require online interaction to perform.
Did you know the Map component caches (stores) previously visited OSM tiles? The app using the component does this automatically. however you can not actually create a library of the tiles without previously visiting the specific tile the 'zoom' is set for.
Don't believe it? See What map used in APP now? is it OK to use a downloaded map and works offline? - #2 by SteveJG
Tim: Ok, I implemented the solution you suggested, but as I suspected beforehand, the situation hasn’t changed. But why would I have even thought it would change, since CenterFromString waits for tile loading just like PanTo; the only difference is that it jumps directly to the point instead of sliding there. If, during the freeze, I somehow manage to activate the exit button, it throws the following error.
I’d kindly ask you to consider adding a timeout parameter, or any other suitable solution.
the frequency you attempt to update the map (Interval)
the signal strength of your data or wifi signal at the time of the issue. Part of the issue might be an OSM issue and not necessarily performance of Map (number of users accessing the server at the same time you are (traffic congestion)) The donated OSM servers are not totally reliable.
how you coded your app. An image of your Blocks to share or an aia to share and test would be helpful for others to help debug your Project. We don't have that now. Whether you use custom Markers (setting the ImageAsset to a custom image and how you code this) etc. may be a factor. Whether you are also using ORS as part of your app. Whether you make distance calculations based on your present location coordinates and how you make the calculation (there are several ways to determine distance between coordinates).
whether you use Map with a gps provider or fused.
whether you use Roads or Areal or Terrain or Custom MapTypes along with the appropriate zoom. Depending on the map tiles OSM has available the higher magnification zoom that is possible in any geographical area depends on whether OSM has the tiles at the magnification for that area.
whether you use the LocationSensor linked to Map or not.
your actual device model and Android version etc.
I do not usually use the PanTo component for the reasons Tim mentions. When you invoke it you should use CenterFromString and then set the zoom.
I had what I think are similar freezing issues. For me, sticking or not posting the correct location or freezing) disappeared.
Sliding?? guess you update very often and the method above sets a specific location.
No one can duplicate your still freezing when using CenterFromString instead of Pan unless you share some code.
I’m using the default Map component settings with OpenStreetMap, set to the Roads parameter.
There are 2 visible markers for the planned route, plus one invisible marker for my own position and another one for the possible destination, used for distance and direction calculation (with the built-in functions).
I don’t use ORS, because I don’t know what it is
For GPS navigation, I’m using TaifunLocationService.
The zoom level was between 15 and 17 when the issue occurred.
My devices: Xperia Z1 Compact with Android 5.1, and Motorola G31 with Android 12.
this amount of refreshing is probably too fast to allow the requests made to the OSM server to keep up with changes. I expect that refresh rate is what causes your app to freeze. Slow it down and you might avoid the freeze; experiment.
you should be doing this with Taifun's OnLocatlionChanged event rather than using the Clock. You do a LOT of calculations in this Block which could delay your updates.
ORS (open route service) is what the Navigation control uses to follow roads on a map to show how to get from one location to another.
...running in the foreground or background. This could also be a source of freezing if you are capturing all this data on a database as Taifun's tool is intended to do .
However you are trying to update the user interface from the background. This will not work. In the background there does not exist a user interface. Also global variables do not exist in the background.
I may have misunderstood this foreground/background thing. The goal was for GPS position reception to keep working even when the screen is turned off. That’s why I used the OnLocationChanged function. However, the freezing occurred during testing when the screen was on, in both cases.
Yes, you can get new locations while the app is in the background, however you then can't update something in the user interface, you only can do this in the foreground
Your freezing issue seems to be because if something different
Don't use that fast running clock, use the LocationChanget event of the location sensor to update your map