Hello Friends,
I want to add utility in which Whenever user tries to Exit (Either from exit command or Pressing END(Red End Button on Phone)), I want to send sms on one Number. So, I tried to Add sms code in destroyApp() function. Here the code is,
This code is working fine in defaultConfiguration.Code:public void destroyApp(boolean unconditional) { try { String s = "sms://0000000000"; // 10 Digit Valid Mobile Number textField = getTextField(); textBox_Summary = getTextBox_Summary(); String msg = textField.getString().trim() + " " + pid.toString() + " " + textBox_Summary.getString(); MessageConnection mc = (MessageConnection) Connector.open(s); System.out.println(mc.toString()); TextMessage tm = (TextMessage) mc.newMessage(MessageConnection.TEXT_MESSAGE); tm.setPayloadText(msg); mc.send(tm); notifyDestroyed(); } catch (Exception e) { e.printStackTrace(); // exitMIDlet(); } }
But when I try to run in Series 40 6th Edition Emulator or In real Nokia device, its not working.
In Emulator, I am getting this error :
Then what should I do that this works? I tried to change Security Option of Nokia Midlet, but that was also not worked.Code:Using Trusted simulated domain Exception: java/lang/ClassNotFoundException at com.sun.midp.io.InternalConnector.openPrim(+135) at com.sun.midp.io.InternalConnector.open(+9) at javax.microedition.io.Connector.open(+6) at javax.microedition.io.Connector.open(+6) at javax.microedition.io.Connector.open(+5) at pkg.com.log.ONOFFAPP1.destroyApp(+78) at javax.microedition.midlet.MIDletProxy.destroyApp(+8) com.nokia.mid.impl.isa.io.protocol.external.sms.Protocol@d590dbc
Thanking You,
Hakoo Desai.

Reply With Quote



