I have in my database a part like this: in that the app saves all the user locations and in various fragments of the app recover all the keys of the users that are near.
The problem is if i only wanna recover "X" keys (30 for example) and there are more than that number into the range of the query. When i recover, i save into a list that "X" keys, but the query retrieve all the keys in range anyway, and it costs too much time.
How can i can cancel the query when i want? Or force the onGeyQueryReady event?
There is no way to cancel a query once it has started. Nor is there a way to limit a Geoquery to a certain number of results.
What you can do is to count the number of keys you've already received in onKeyEntered
, and then stop processing further keys once you've gotten 30.