I wanted to extend on a tip that was provided previously. I was able to incorporate some functionality that I think really helps out when attempting to get a users geographic address.
Something I’ve had difficulty with was permissions. In the past I had some weird behaviors and had to give up on a function that required requesting the users address. Once they blocked the request I always got bug errors in the debugger.
I found on the forum a tip by @romanmg that got me started. I highly recommend checking it out as I won’t go over what she covered very well.
One issue with this method is that it is not always accurate. There are two types of IP address…IPv4 and IPv6 and the plugin that bubble created uses a service that doesn’t regularly provide the same IP address type.
My first tests I got accurate results. With subsequent tests the following day the address was a couple hundred kilometers away. This was explained by bubble support to be caused by a return of the IPv6 instead of IPv4. Apparently it is the provided the plugin uses and not in bubble control.
I am not sure why the bubble built in “current geographic position” always returns accurate results, I’d assume they use the same provider for IP address details, but maybe not. The problem with “current geographic position” is that it asks for permission and once a user denies, it never asks them again and just provides a error message in the debugger tool that the user has denied geolocation services.
I had tried without success to get feedback from the bubble community on their experiences with this issue.
Wow - I finally managed to get this working. Thanks @boston85719 for documenting what you did, and @NigelG for sharing the Regex.
Just for anyone else reading this, I had to do a couple of things a bit differently, no idea why but maybe someone has some ideas.
First, I wanted to save the values to a State. When I extracted the coordinates, it would only extract them a a List of Texts. So I had to use Convert to a Number, and then I had to have my Latitute and Longitude Number States set up as Lists.
Then when I used the Latitude and Longitude in CalculateCoordtoAddress I had to use :FirstItem for each of them. Probably something I did wrong, but at least it works now in the end. Finally I can order my RG by an Item’s distance from the User, even when the are not logged in!
This seems an awfully over-complicated thing to have to do though! Would it not be possible for the IP Geo Plugin to just determine a Geographic Address in the first place?