11-08-2010 05:15 AM
I have used a DataGramConnection for implementing the sending and receiving of SMS.
My listening thread, which is 'always on background thread', is blocked by the receive method of the datagramconnection.
I came across the message listener interface. If message listener is implemented, we will be notified during an incoming SMS. This gives the oppurtunity for efficient background thread implementation. But i have to use MessageConnection instead of DatagramConnection to implement the message listener.
As per my requirements, when sending an SMS, I need to set MessageClass as CLASS 0, MessageType as SHORT_TYPE_0 and Message encoding as "UTF-8". I can achieve all this if i use datagram connection. But i cant do all these, if i try to use messageconnection.
Is it possible to use seperate DatagramConnection for sending messages and seperate MessageConnection for receiving messages. (It seems very illogical)
is there an efficient way to implement receiving and sending of messages?
11-08-2010 08:47 AM - edited 11-08-2010 08:47 AM
Datagram is the right way to go - the MessageConnection class has a limitation that only one application may claim the connector - the 2nd app gets an error message.