I created a button that grabs GPS coordinates when pressing a button and then runs a hook.
The new coordinates aren’t being passed, only the previous data in the keys.
When I break it down to 2 buttons, 1.grab, 2.run hook it works.
Any suggestions?
I tried calling a namedAction that calls a hook but that didn’t seem to help.
Yes, basically when you are clicking the get co-ords button you are ‘making a request’ to the device OS for the geo co-ords. This request is asynchronous meaning the result is not returned right away,
If you post your code, we can mod it so that the callback
is what runs the hook after the co-ords are ready.
GPS on devices is not constantly running so takes time to get results.
So, as per Andrew’s suggestion, a 100ms pause did the trick!
Note: This will probably break when the OS asks for permission.
For future readers, run the utility hook from the success
of the function like this
// in your function
navigator.geolocation.getCurrentPosition( result=>bf.namedAction( 'mySuccessNamedAction' , { result:result } ) )
1 Like