java - Receive text message using J2ME -


i trying make j2me application send , receive text messages. i'm done sending part of not able receive message..

below tried in order receive text message;

    try {         messageconnection conn = (messageconnection) connector.open("sms://:50001");         conn.setmessagelistener(new messagelistener() {             public void notifyincomingmessage(messageconnection conn) {                 try {                     message msg;                     msg = conn.receive();                     if (msg instanceof textmessage) {                         textmessage tmsg = (textmessage) msg;                         stringitem.settext("msg: " + tmsg.getpayloadtext());                         system.out.println(tmsg.getpayloadtext());                     }                     // else if(msg instanceof binarymessage) {                     // .....                     // } else {                     // ......                     // }                 } catch (ioexception ex) {                     ex.printstacktrace();                 } {                     try {                         conn.close();                     } catch (ioexception ex) {                         ex.printstacktrace();                     }                 }             }         });     } catch (exception e1) {         system.out.println(e1);     } 

but not working...no errors showing either...what doing wrong?...can receive message using j2me?

the code sending message: (updated)

messageconnection conn = (messageconnection) connector.open("sms://:50001"); textmessage tmsg = (textmessage) conn.newmessage(messageconnection.text_message); tmsg.setpayloadtext(message); tmsg.setaddress("sms://" + number); conn.send(); 

i have both send , receive functions in 2 different forms. did install , start application in 2 different mobiles, send message 1 mobile other , receive in other.

the message sent , received successfully, not in application. message goes inbox of other mobile.

what can do?

try 5000 port no.

some phone have port sms listener


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -