I’m using Messaging Publish to try to make a forum , and I know that to send messages to a channel I must use:
PublishOptions publishOptions=new PublishOptions();
publishOptions.setSubtopic(“country.city.lima’”); // as a level of filtering
Backendless.Messaging.publish(“default”, “message to send”, publishOptions,new AsyncCallback<MessageStatus>()
{ @Override
public void handleResponse(MessageStatus response)
{
showToast(“Message Id:”+" " + response.getMessageId()); } @Override
public void handleFault(BackendlessFault fault)
{
showToast(“Error:”+" " + fault.getMessage());
}
});
With the code shown above I send messages to “default” channel, but if I want to retrieve those messages, I use this code , but I’m not sure how to retrieve the message sent in the code of above
AsyncCallback<List<Message>> subscriptionResponder = new AsyncCallback<List<Message>>()
{
public void handleResponse( List<Message> response )
{
}
public void handleFault( BackendlessFault fault )
{
}
};
SubscriptionOptions subscriptionOptions = new SubscriptionOptions();
subscriptionOptions.setSelector(“country.city.lima”);
Backendless.Messaging.subscribe(subscriptionResponder, subscriptionOptions, new AsyncCallback<Subscription>()
{ @Override
public void handleResponse(Subscription response)
{
} @Override
public void handleFault(BackendlessFault fault)
{
}
});
You set subtopic to country.city.lima’ when you publish (notice the trailing accent character), but when subscribing you set selector to country.city.lima (no trailing accent character). Can you please verify whether it’s a typo only here or in your code, too?