RuntimeException calling Backendless.Messaging.subscribe

Caused by: BackendlessException{ code: ‘Internal client exception’, message: ‘null’ }

This is my code:

subscription = Backendless.Messaging.subscribe("testchannel", new AsyncCallback<List<Message>>() {
    @Override
    public void handleResponse(List<Message> messages) {
        Log.d(TAG, "New post message");
        reloadStory();
    }

    @Override
    public void handleFault(BackendlessFault backendlessFault) {

    }
});

Hello, Ludwig!

I see that you’re using sync version of subscribe() method. Are you calling this method from device?
best regards,
Alex

Yes, from and Android device.

Hi Ludwig,

This is a synchronous API - it is not allowed on the main UI thread in Android. Please make sure to use the following signature:

public void Backendless.Messaging.subscribe( AsyncCallback<List<Message>> subscriptionResponder, AsyncCallback<Subscription> methodCallback )

Regards,
Mark

Ah thanks! Would be awesome with some javadocs also :slight_smile:

I think it would just duplicate the same info:

http://support.backendless.com/public/attachments/400af95ac38d823b83ea1d417c709850.png&lt;/img&gt;

But what is the difference form two callbacks? In my head the logic is:

  • I subscribe to topic.
  • callback return me error or not if the subscription is done.

Why there are two callbacks so?

One callback is to notify you that you are subscribed or not. And other to receive messages

Yes but I want to manage message received in other part of my app :slight_smile:

So what is your question?