This repository was archived by the owner on Feb 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
This repository was archived by the owner on Feb 23, 2021. It is now read-only.
Calling Subscription more than one time #17
Copy link
Copy link
Open
Description
Works fine
When I subscribe first time its work fine
Not working
when i move back from current screen after unsubscribing and come back to same screen it invoking more than one time
isSubscribed = false;
if(!isSubscribed) {
isSubscribed = true;
sub = new BaseQuery.Builder("Message")
.addField("message")
.addField(MSG_RECEIVER_USER_ID)
.addField(MSG_SENDER_USER_ID)
.build()
.subscribe();
sub.on(LiveQueryEvent.CREATE, new OnListener() {
@Override
public void on(JSONObject object) {
Log.e(TAG, "on: " + object);
// Action to be executed here when an object that matches
// The filter you set up
}
});
}else{
if(sub != null){
if(sub.isSubscribed()){
sub.unsubscribe();
isSubscribed = false;
}
}
}
}
output (invoking more than one times)
on: {"op":"create","clientId":22,"requestId":2,"object":{"className":"Message",
"objectId":"MoItqxnFGC","updatedAt":"2017-02-27T10:37:08.679Z","createdAt":"2017-02-27T10:37:08.679Z","message":"dhjjf",
"receiver_user_id":"Rb4bg9Nv5z","sender_user_id":"ewaCQ6Y2I4"}}
on: {"op":"create","clientId":22,"requestId":2,"object":{"className":"Message",
"objectId":"MoItqxnFGC","updatedAt":"2017-02-27T10:37:08.679Z","createdAt":"2017-02-27T10:37:08.679Z","message":"dhjjf",
"receiver_user_id":"Rb4bg9Nv5z","sender_user_id":"ewaCQ6Y2I4"}}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels