This is a migrated thread and some comments may be shown as answers.

Filtering by geolocation

1 Answer 73 Views
Android SDK
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dobromir
Top achievements
Rank 1
Dobromir asked on 11 Oct 2014, 07:13 PM
Hello everyone,
what I need is that function over there in Javascript SDK for filtering near geo point. 

var query = new Everlive.Query();
query.where().nearSphere('Location', [23.379068, 42.650601], 100, 'km');

Is this functionality available in Android SDK?
Thank you

1 Answer, 1 is accepted

Sort by
0
Anton Dobrev
Telerik team
answered on 14 Oct 2014, 04:29 PM
Hello Dobromir,

The Android SDK currently does not expose querying on GeoPoint fields out of the box. In order to achieve this you need to send a header with the filter to the REST API of  Backend Services as explained here, by appending it as an "X-Everlive-Filter" header to the request.

For example:
public ArrayList<Book> GetBooks(EverliveApp app) {
    RequestResult<ArrayList<Book>> requestResult = app.workWith().
                data(Book.class).
                getAll().beforeRequest(new GenericCallbackAction<Request>() {
            @Override
            public void invoke(Request request) {
                request.getHeaders().put("X-Everlive-Filter", "Stringified filter value here");
            }
        }).executeSync();
 
    return requestResult.getSuccess() ? requestResult.getValue() : null;
}

Let me know if this works for you and if you have questions.

Regards,
Anton Dobrev
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
Tags
Android SDK
Asked by
Dobromir
Top achievements
Rank 1
Answers by
Anton Dobrev
Telerik team
Share this question
or