wood burning stoves*
The moose likes Java Micro Edition and the fly likes Mms and sms at the same midlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Mms and sms at the same midlet" Watch "Mms and sms at the same midlet" New topic
Author

Mms and sms at the same midlet

Artemis Papakonstantinou
Greenhorn

Joined: Oct 23, 2007
Posts: 3
Well my problem is similar to "couldn't sms and mms coexist?" thread..

When i register 2 MessageListeners,one for sms and one for mms,the messages are sometimes received but sometimes they aren't.The notifyIncomingMessage method,that is supposed to be called automatically when a message comes to the MessageConnection is called in an upredictable way(e.g:1st,4th,5th time)..so there's nothing specific wrong in my code.
On the other hand when i register only one messageListener it works fine,so i can test seperately mms from sms but not together...
Well,i know that if i have two different middlets,one only for sms and another only for mms it will work ok.I'm working with WTK2.5 and there is an example where sms is received in different middlet than sms does..but i want to have a general gui for both of them..



If anyone has faced a similar problem please help me....because...

Olivier Houyoux
Greenhorn

Joined: Oct 17, 2007
Posts: 13
Hi,

Have you try to listen to both SMS and MMS in separate Threads ?


SCJP5
SCJD
SCMAD
Artemis Papakonstantinou
Greenhorn

Joined: Oct 23, 2007
Posts: 3
Originally posted by Olivier Houyoux:
Hi,

Have you try to listen to both SMS and MMS in separate Threads ?


You mean different thread that handles sms and a different one for mms?
Well i have different classes and different threads for sms and mms receiving.But it is not a thread problem(i also thought it could be)..The notifyIncomingMessage is being called sometimes but sometimes is not..
Olivier Houyoux
Greenhorn

Joined: Oct 17, 2007
Posts: 13
That's what I meant.
Could you post or send me your code so that I can check a little bit further.

And by the way, what dev environment are you working on and what kind of mobile phone do you use to test your app ?
Artemis Papakonstantinou
Greenhorn

Joined: Oct 23, 2007
Posts: 3
Originally posted by Olivier Houyoux:
That's what I meant.
Could you post or send me your code so that I can check a little bit further.

And by the way, what dev environment are you working on and what kind of mobile phone do you use to test your app ?



I'm working with eclipse and wtk2.5 on CLDC 1.1 and MIDP 2.1.
My code is huge so i can post only a part..

There are two connections open with a MessageListener for each one:

if(mmsCon1==null){
try {
mmsCon1 = (MessageConnection) Connector.open("mms://:"+appId);
mmsCon1.setMessageListener(this);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

public void notifyIncomingMessage(MessageConnection conn) {
// Callback for inbound message.
// Start a new thread to receive the message.

System.out.println("Notify for mms");
thread=new Thread(this);
thread.start();

}

and in an other class...

try {
smsCon1 = (MessageConnection) Connector.open("sms://:"+smsPort);
this.smsCon1.setMessageListener(this);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

public void notifyIncomingMessage(MessageConnection arg0) {

System.out.println("New sms recerived");

thread=new Thread(this);
thread.start();

}

i didn't post the run methods because it's not a thread problem...notifyIncomingMessage is not even called.I also tried to have a single listener for both connections but nothing..
Eric Smith
Greenhorn

Joined: Mar 11, 2008
Posts: 2
Hi!
did you solve your problem? I met the same...
thanks
Shashi kiran Rao
Greenhorn

Joined: Jul 30, 2010
Posts: 1
I tried in WTK 3.0 & both SMS & MMS are working fine. It seems their is some issue with WTK 2.5.2 with respect to listeners.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mms and sms at the same midlet
 
Similar Threads
SMS port numbers (possibly FAO M. Yuan?)
MMS not received?
J2ME project
Couldn't MMS coexist with SMS?
When to open MessageConnection (Push Registry)?