how to use the queue-messaging family of methods in smslib?

774 Views Asked by At

I dont know how to implement the queue messaging in smslib, I receive a new sms and I store in a database table, I make some logic and then I produce a new sms, I already archieve this -synchronous way, but I dont know how to do it in asynchronous way?? can someone guide me or maybe a hint, I see the docs but I dont know how to make the queue since I am receving and sending sms???, I need to run this app and I want that every user gets an answer, for example I use the method Service.getInstance().queueMessage(msg); but It did the same as Service.getInstance.sendMessage(), so my question is how to use the queue in smslib??

can someone guide me on this??

1

There are 1 best solutions below

0
On

The sendMessage() and queueMessage() methods both send the messages through your modem, but there is fundamental difference; sendMessage() does it synchronously and queueMessage() does is asynchronously (as you said yourself).

This means that sendMessage() will basically forward the message to the modem, block it until the message is sent, and then return. If you however are using the queueMessage() method, it will store the message in a queue and the send it "when it can", without blocking the modem.

To get the send status from this message (if it was sent or not, any errors etc) you need to make a class that implements the IOutboundMessageNotification interface. There, in the process method, you get the status message and you can handle it according to you own implementation.

You set you service to "listen" to these notifications using Service.getInstance().setOutboundMessageNotification(outboundMessageNotification);. The same applies if you want to listen to incoming messages using IInboundMessageNotification.

Hope it helped

-Rob