we used to have a DatagramConnection for sending sms but found out that there is a bug
. We had our application corrupting the first SMS it sended each time, all following were ok, quite strange.
Maybe there are more people who find this information valuable thus our new code:
MessageConnection _dc = (MessageConnection)Connector.open("sms://"+mobilnummer);
Message sms = _dc.newMessage(MessageConnection.TEXT_MESSAGE);
TextMessage sms2 = (TextMessage)sms;
the casting is a bit irky but it works. It seems you can not create a TextMessage as the constructor of MessageConnection always creates a Message-object, the setPayload-function requires a TextMessage-object though.
If you have a solution without casting please post it as a reply,
the code above works fine.