How to properly use sensor variables to acquire lat/long info

I have tried many different ways to use appgyver’s “gps location” function to collect current lat/long of the device using appgyver. I have failed on each attempt. The best I’ve been able to do is to create the record on the backend (xano) but the lat and long both = 0. This is true for IOS and android devices. Any tips??

1 Like

Hey,

The flow function seems to work fine on my end, can I see a screenshot of your logic flow and how you store those values?

Its working, but there are a couple of fairly show stopping bugs though there are workarounds. You can´t write location data to a variable in Android / IoS and in webapps the system sensor values are not updated - you have to install the component “get location for web app”.

So it works, but not how its intended to.

I was able to get the “gps location” function to work. I just had to add page variables for Lat. and Long. and add a “set page variable” function for each in the logic flow. For each of them, I had to use a custom formula for the value of the variable that I was setting.

example for latitude
“STRING(sensorVars.geolocation.latestValue.latitude)”

Even though this forced me to change the variable value type from number to text, the xano api was able to handle the incoming text and convert it to a decimal without any additional steps needed.

I hope this helps someone else. This took quite a few hours for me to figure out.

2 Likes

Storing the values was my issue. I was trying to create a record and use the sensor variable values for the API. This would not work for me. Instead, I used the “get location” function and followed that with “set page variable” and set corresponding page variable values to a STRING(sensorvariable.value) and then used the page variables for the API. Hopefully that makes sense. I had zero knowledge of app development 2 weeks ago so I’m not sure how to discuss these things.

1 Like

Did you also get the GPS value in the preview app?

That was one way that I tested that this was actually functioning. I added a text box with a value of the same formula that I was using for the page variable to see that the device sensors were functioning properly.

I do not speak Spanish whatsoever, but this video was a huge help for me. You can see the necessary formulas.

https://www.youtube.com/watch?v=NksqeDeDli8