Count number of online users within a geographical radius

Hello bubblers, I am building a social network application I am not able to create a feature where a user can see total number of all online users within 100 km of his radius.
Thanks,

There is a built in search constraint when you constrain by a data field that is of geographic location, to constrain by some number of either kilometers or miles.

Do you have data field of geographic location on the user datatype?

No I donā€™t have

First step. Add a data field of geographic location to the user data type.

Next will we have to update his location , say every 2 mins in the database ???

I guess if you are trying to track the user. I initially thought it was meant to be a ā€˜staticā€™ position in which you can say you store in the DB their ā€˜homeā€™ address or something like that.

Getting to track your users location you can use the ā€˜current users locationā€™ feature.

1 Like

You can only do that when the app is ā€œonlineā€ you canā€™t run something in the backend every 2 minutes to find the location. You will just find the location of the AWS Bubble server in Portland !

So run it on page action action instead.

An alternative is to use IP address of the user, and use a plugin to work out approximate location.

1 Like

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