We are trying to build an app that uses the geolocation poller to capture the users location every second and connect this to a POST request to log the latest record to an external data source (JSONbox currently just for testing).
We currently start polling when the ‘Start Route’ button is pressed, with the following logic:
This doesn’t post to JSONbox every second with the latest value (which is selected within the JSONbox Create Record logic) like I would expect. I found a workaround which is as follows:
But we are seeing issues between iOS and Android in both polling frequency as interpreted by the device and also can’t quite understand if polling is continuing in the background (it doesn’t seem to, despite us not stopping the polling in the logic).
Ultimately, we want to log the latest record to an external datastore every second, and wanted to ask if this was the right way to achieve this or if we are missing something!
Nudge to get this back to the top.
Hi, sorry for taking so long to answer.
Firstly, the frequency will likely fail here because Delay takes exactly 1 second now, but executing GPS Location and especially Create record take time also. This means the loops will likely be longer than one second. —> To make sure the loops are (closer to) exactly one second, you need to take at least Create record away from the loop.
Secondly, you have attached the loop to a some component (Button?) which means the polling might stop if Page of the Button or Button itself doesn’t exist in app memory anymore, i.e. are unmounted. The best place for this poller is therefore Global canvas. It won’t unmount and will be accessible from anywhere in the app through Receive/Trigger event Flow functions.
Here’s my draft suggestion how to use the logic:
If you want to add a possibility to stop polling to the logic, just create some app variable, e.g.
polling_should_continue and test its value in the loop and stop looping if it tells you to stop.
Hello David_Brown & Tommi_Laakso,
I am researching AppGyver for my use case below and wanted to know if I am likely to succeed.
Use Case: Use the App as a live location tracker for a courier business.