Support Topics Documentation Slack YouTube Blog

UpdateListener doesn't accept where clause with distanceOnSphere

Hello!

I have a where_clause = “distanceOnSphere(location,‘POINT(35.9299327 34.9075932)’) < 5000”;
When I use this where clause with a Backendless.Data.of(“my_table”).find(query_builder, …); it returns correct results
But if I use the same where clause with EventHandlerOfMyTable.addUpdateListener(where_clause,…); then it produces the following error:
update listener{code=0, details={whereClause= distanceOnSphere(location,‘POINT(xxxxxx xxxxxx)’) < 5000 }, message=Bad Request: Invalid where clause}
Even though I use the same where_clause in both examples;
Am I missing something?

Hi @Maria_Kudriashova!

Sorry for inconvinience.
Internal ticket BKNDLSS-21408 was created for this problem. It will be fixed in next release. We will notify you when fix will be available.

Regards, Andriy

Hello @Maria_Kudriashova

According to our doc https://backendless.com/docs/android/rt_condition_query_syntax.html
we support only general whereClause for RT Listeners, so we are going to fix the error, however, your whereClause with Spatial Types won’t work anyway.

Regards, Vlad

Hello!

Is there any way to implement a real-time query like in GeoFire using the backendless SDK?

Given a radius and objects which are changing their locations continuously, I need to query objects in circle area, is it possible?

Would it be a good solution to run a query each n of seconds?

I would do it by using AfterObjectUpdate in the Business Logic.
Each time object location is changed run query with Geo to check if this locations is fit for something and then maybe send pub-sub message to particular devices/clients channel which is subscribed on messages in the channel using RT

or detecting the location changes on the client and send requests (with GEO query) from the client