[Location Plugin] GetLocation returns position of previous GetLocation
Mobile icon
Forge component by Platform Maintenance
Application Type


I have a mobile app that, upon the push of a button, requests location by using Location Plugin - GetLocation. For some reason I can't figure out, the location I receive is that of a previous GetLocation. Ie., if I go to Location 1, then Location 2 and then Location 3, and I GetLocation for each of those Locations, Location 2 will show me the latitude and longitude of Location 1, and Location 3 will show latitude and longitude of Location 2. 

I already tried to experiment with GetLocation configuration - setting MaximumAge to 0 and increasing Timeout (which wasn't needed since I get Location very quickly - probably because it is cached somewhere).

I've added screenshots of the function I use to GetLocation along with short comments. If anyone has any idea I would really appreciate it!



Screenshot 2022-05-03 at 17.30.31.png

Can you post the logic of your server action (or the oml) so that I can look at your logic. This seems to be a matter of "when" things are occurring, but I can't help more than that without a specific look.

Hi, added screenshot below.



Screenshot 2022-05-03 at 17.48.39.png

Okay, that wasn't what I was expecting. So, the logic you show in your first picture illustrates getting the lat and long, but where is the history being called. Where are you asking for get location 1, 2, etc.

The locations are saved on database tables. The way I know the location is wrong is because if I go to Location 2 (after going to Location 1 and doing GetLocation), i can see afterwards that my position is wrong (i utilize map on another app). Also checkable by going to google maps and pasting latitude and longitude. 

So, that sounds correct and a very solid approach. It sounds to me like either the indexing is off or the update of the location is an entry behind.

I think the indexing is solid, because when you check the data in the database tables you can see it is off (by manually checking the latitude and longitude in google maps). Seems to me as well that the update of the location is an entry behind, however I can't understand why nor do I know how to check if this is true. 

@Fran C, I do see the call for the storing the location in the first image, and I see that you are using an entity to store the entries, but where are you making the call to retrieve the entries?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.