Current Geographic Address- Does it auto update?

I have an App that requires the user to upload their current Geo Position every X seconds. The problem is that it doesn’t auto update their position. As in the app updates the database with the same old Geo data. I am using MapBox plugin. Only when I turn on Live location Tracking from MapBox does the Current Geographic Address updates in real time.
But I want them to update their location without have to load the map element. is there a way to do this?

Hi I have the same problem, did you find a solution?

So the solution i found to this is using my own custom script.

You cannot at any point initiate the the dynamic bubble expression, “Current Geographic Position” on the same page with this solution or else one of them wont work
Install the toolBox Plugin.
in workFlows add “do when element is clicked” or “do when Condition is true”
Add an action → Plugin → Run JavaScript

navigator.geolocation.watchPosition(showPosition);
function showPosition(position) {
LAT = position.coords.latitude;
LON = position.coords.longitude;
console.log(LAT);
bubble_fn_CurrPos([[LAT], [LON]]);
}

Add the above JS
add a javascript to Bubble element to the page
in the bubble_fnsuffix add CurrPos
check publish value, change data type to number, check value is a list

Please note that you only need to run this script once and it will start a live GPS location tracking
Now when ever you need the users latitude and logitude just point to the “javascripttobubble element’s first item” → this is the Latitude
“javascripttobubble’s last item” → This is the Longitude

you can do something like update user lat & lon every x seconds.

my use case is for taxi service, drivers update their location. This solution goes nice with mapbox price plan as they charge per user in blocks of 12hrs. so every time a user opens a map element for the next 12hrs they can use the map unlimited, even if they close and open the browser (of course it has to be the same browser and accept cookies).

@ZeroqodeTeam Thanks for the response. but i dont think you fully understood what i was trying to acheive, and i think is that i didnt explaing my self properly enough. but thanks anyways.

for more info vist link below
https://www.w3schools.com/html/html5_geolocation.asp

there is a method to STOP the function of getting user’s current position

2 Likes

Great thanks for sharing Akiempaul,

could I know what’s your solution to update user lat & lon in the background? especially when the web page is not open and that “do every x seconds” won’t work.
I have a quite similar case but get a little bit stuck recently. The main problem is, if the driver hides or leaves the web browser or app, (say the driver hides your app and opens Google map or Apple map app to navigate), is it still possible to access the driver location from the background?

thanks