Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 38
Registered: ‎10-27-2010
My Device: Blackberry Torch 9800

Efficient way for listening to incoming SMS?

Hi,

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?

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Efficient way for listening to incoming SMS?

[ Edited ]

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.

 

Developer
Posts: 38
Registered: ‎10-27-2010
My Device: Blackberry Torch 9800

Re: Efficient way for listening to incoming SMS?

 

Hi doug, thanks for the reply, thats totally new info, so there is no way to avoid the receive method to block the thread, when using datagram connection?