How to Use Custom Custom Business Logic in Android Studio ||

I’am using sub/pub messages service… but when I subscribe to a channel it give me Error : " BackendlessException{ code: ‘Internal client exception’, message: ‘null’ }"
what is the problem ? And thanks

Are you using sync or async method?

async

Could you please share your code here?

ok no problem …wait please

Backendless.Messaging.subscribe("Messages", new
        AsyncCallback<List<com.backendless.messaging.Message>>() {
            @Override
            public void handleResponse(List<com.backendless.messaging.Message> usersmessages) {
                messagesAdapter adapter = new messagesAdapter(MainActivity.this,usersmessages);
                v.setAdapter(adapter);
            }
            @Override
            public void handleFault(BackendlessFault backendlessFault) {
            }
        });



Do you receive a response in handleResponse or fault in handleFault?

the code isn’t running at all … it is crashes at that line : Backendless.Messaging.subscribe

Do you receive any stacktrace?

This is NOT an async call. The async call has also argument AsyncCallback<Subscription>

Mark

Yeah you are right … but now I get another exception when I’am getting the data of the message

the error is : java.util.NoSuchElementException at this line : messageIterator.next().getData().toString()

Please, don’t expect we gonna debug your code intuitively or in any other way.
https://www.google.com.ua/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=why+am+i+getting+nosuchelement+exception

OK I just though that this is a problem from the server .Thanks anyway

I’ve successfully used pub/sub messages with my app … it’s good and not slow … but there is one problem … the messages are deleted from the server … I think they are deleted to Reduce the pressure on the server … Maybe I can save the messages to a data table and then get the rows from it … and every row must contain message …I think that this is a great solution but I don’t know how to do that … if there are better solutions please tell me … and Sorry to disturb you …

Hello!
You idea makes sense. Really, messages live in channel for a short time, so if you want to save them permanently - you can use handler for publish event and save the message to persistence in it.
best regards,
Alex

Thanks for replay … so how can I save the messages in data table ? because when I subscribe to a channel and get the messages … I get them as List<Message> … I don’t know how to save that to dataTable

You can add a server-side “event handler” for the “Publish” event. The handler is Java code which runs on our servers. You can use our Android SDK in that code to save messages in a table.

Iterate through the list and save message contents to your custom table using our Data service.

And to use server_side I mustn’t use AndroidStudio right ?