Send port SMS to any mobile?

2019-08-01 03:59发布

问题:

I have a midlet that could send sms. in J2me the sms is with a port number. But I want it sent to any mobile without specifying the port number. Could I achieve that? Or is it possible if I send from server sider through SMS gateway API to any mobiles?

回答1:

As far as I know if you specify the port number to 0, it will send the SMS as a standard SMS and the other phone will receive it and put the message in the Inbox.

String url = "sms://1234567:0";
MessageConnection conn = (MessageConnection)Connector.open(url);
TextMessage msg = (TextMessage)conn.newMessage(MessageConnection.TEXT_MESSAGE);
msg.setPayloadText("hello");
conn.send(msg);
conn.close();

I hope it helps!



标签: java-me