How to trigger "watchPosition" to get current Geographical Position

How do you get the current geographical position to update as you physically move around?

Does this require a page reload or is there way to execute ‘watchPosition’ or update position every X seconds.

My return values are depended on the current users geo position but this value does not change as the user moves.

I read that there are two basic calls while implanting the plugin relative to this. One is “getCurrentPosition” (gets location once) and “watchPosition” (tracks the position as you move). Source: http:// html5doctor . com / finding-your-position-with-geolocation/

Tested in IOS Safari.

Thanks in advance…

  1. Store the watchPosition as a state.
  2. Run an action in the worklflow retrieves the Current Geographic Position every x seconds:


Hello ,

Does it work in an IOS app or Android, even when the app is not open?

I am trying to udpdate a current user position every 15 min relative to his address …So I setup a workflow, to check the distance between his address and current position every 15 min.

does this workflow works, even if the App is not open ? I mean I open it, then I use another app
When I open the IOS app, most of time it’s reloading the page, does it means the app stopped? why the reload?

Many thanks for your help

Are you using the Bubble app to test on iOS ( or just the browser?

I am using my app, published on apple store, I used gonative to do it .

I made a test, creating automatically a list of geographical position every 60 seconds, when I don’t use the app (mean I opened it, then I open another app) , the workflow does not run in backgroud.

I don’t think it’ll do it in the background by itself.

So basically nothing happens in a mobile app bubble IOS, if you don’t keep the app open and visible …so notification of a new event or data change etc …are useless because no workflow will be triggered.
at least on IOS, did not try on Android …that’s a big issue.

There are other ways to do it that don’t require true native.

What kind of ways ?

As a bubble hack, you can create a workflow that “pings” the bubble server every x seconds, to timestamp a custom state.

  1. Create a state: stamp (type:date/time)
  2. Workflow: Every 5 seconds, set the current day/time to the stamp state, only when current user is logged in

Now simply test for the amount of time between stamps to determine if your app is visible. For example, if the stamp state hasn’t been set in 30 seconds, it might be safe to assume the user doesn’t have your app open.

1 Like

Interesting method, I will try,
but I pretty sure the workflow stop when the app is not visible on screen, as well a the geolocalisation.

is the Endpoint API workflow run even if the app is not open ?

They do

So my idea is to add in the Android App and IOS app, a request using the native backgroud geolocation service and send it to bubble every 5 seconde, on an Endpoint API to update the current location of the user

This topic was automatically closed after 70 days. New replies are no longer allowed.