my dog learned polymorphism*
The moose likes Java Micro Edition and the fly likes Problem: Send Receive SMS in one midlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Problem: Send Receive SMS in one midlet" Watch "Problem: Send Receive SMS in one midlet" New topic
Author

Problem: Send Receive SMS in one midlet

Hardik Patel
Greenhorn

Joined: Mar 26, 2007
Posts: 2
I'm writing one j2me midlet application using WMA library to send and Receive SMS.. Application behavior is : For receiving sms i implemented MessageListner so whenever sms comes, it notify the midlet and in that function i'm creating one thread and receiving sms and doing some parsing. Now i have to reply that sms so i'm sending some reply code by sms in the same thread but then after i'm unable to receive any message. Can any tell me what is the problem behind that? If i comment out send code then my application is able to receive any number of sms. I have used different connector.open objects like SMSREAD and SMSSEND to store message connection.
Please help me in this. My send and receive part works perfectly if i do send and receive in two different midlets....................
Any hint.....................
Thanks in advance for your kind support...................
Eduardo Marques
Ranch Hand

Joined: Feb 19, 2005
Posts: 231
The problem may be that a WMA message listener is called inside a system thread and you should either fire a new thread to handle the message or notify an existing one.

You should not call receive(), much less send a message directly in the listener. Read the WMA javadoc & specs, this is explained in some detail.

Cheers,
Eduardo


Eduardo Marques
Get ready for your SCMAD certification at J2MECertificate.com - See what all the buzz is about ...
Hardik Patel
Greenhorn

Joined: Mar 26, 2007
Posts: 2
Thanks for reply Eduardo.
But i got some other solution also and now it is working...........
so cheers...........
Brice Nkengsa
Greenhorn

Joined: Jun 14, 2011
Posts: 2
Hey Hardik, I'm having the same issue. How did you resolve it without having to separate the send SMS and receive SMS code in two separate midlets?

thanks.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem: Send Receive SMS in one midlet
 
Similar Threads
Not able to Receive sms messages in my emulator over port 50000 but able to send
Code (49) - Application authorization failure"
send and receive sms in same midlet
WMA MIDlets, how do you receive sms without a port no.
WMA MIDlets, how do you receive sms without a port no.