Backendless Support
 
Answered

cancel subscription

hi,

i use bellow code to be subscriber in android, everything is good. but after about 5 seconds i need check if there is no message, cancel request and alarm to user :"nothing received...". but backendless option for cancel subscription not good for me. how do this?

SubscriptionOptions mSubscriptionOptions = new SubscriptionOptions();

mSubscriptionOptions.setSubtopic("topic1");

Backendless.Messaging.subscribe("channel1", new AsyncCallback<List<Message>>() {

public void handleResponse(List<Message> response) {

Log.i(getTag(), response.toString());

}

public void handleFault(BackendlessFault fault) {

Log.e(getTag(), fault.getMessage());

}

},

mSubscriptionOptions, new AsyncCallback<Subscription>() {

public void handleResponse(Subscription response) {

Log.e(getTag(), response.toString());

Subscription mSubscription = response;

mSubscription.cancelSubscription();

}

public void handleFault(BackendlessFault fault) {

Log.e(getTag(), fault.getMessage());

}

});

Leave a Comment

Comments (1)