I am developing Chatting Application for Android. I want to Subscribe Live Query for multiple Contacts in _User Class on Online Status of Users.
ParseQuery<ParseObject> query= ParseQuery.getQuery("_User");
SubscriptionHandling<ParseObject> subscriptionHandling = parseLiveQueryClient.subscribe(query);
subscriptionHandling.handleEvent(SubscriptionHandling.Event.CREATE,
new SubscriptionHandling.HandleEventCallback<ParseObject>() {
@Override
public void onEvent(ParseQuery<ParseObject> query, ParseObject object) {
}
});
This Code works for all Users. But i want to trigger LiveQuery on selected Users. i want to do something like that... At Run time, WhenEver Application Launches.
query.whereEqualsTo("username","USER1");
query.whereEqualsTo("username","USER2");
I am using Library compile 'com.parse:parse-livequery-android:1.0.0'
thanks in Advance
A little late with the reply, but hope it helps others who have encountered the same issue.
The query you should be looking at is: "whereContainedIn"
query.whereContainedIn("username", Arrays.asList("USER1", "USER2"));
As there are two "whereEqualTo" constraints over the same key - which contradicts itself - Parse will only apply one constraint.
For more information, please look at: https://docs.parseplatform.org/android/guide/#limits-and-other-considerations
P.S.: there's also a typo with the language for the constraint. It should be "whereEqualTo", and not "whereEqualsTo".