Samsung Champ 在发送短信时出现问题 (Java ME)
我有一个 midlet,可以向所需号码发送短信。 midlet 在诺基亚 N70 和诺基亚 6300 上运行良好。但是在三星 Champ 上使用时,我只能向某个号码发送一次短信,即,向某个号码发送短信时可以正常工作,但在相同或相同的号码时则无法工作。不同的短信发送到同一号码。它不会给出任何异常或错误。这是我正在使用的代码:
public boolean sendSMS(String contactNum, String payloadText) {
try {
String addr = "sms://" + contactNum;
MessageConnection conn = (MessageConnection) Connector.open(addr);
TextMessage msg = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE);
msg.setPayloadText(payloadText);
if (conn.numberOfSegments(msg) == 0) {
return false;
}
conn.send(msg);
} catch (Exception e) {
new AlertDialog("Exception", "Exception in sendSMS() occurred", "OK").show();
}
return true;
}
请有人在这方面指导我。
谢谢。
I have a midlet which sends an sms to a desired number. The midlet works fine on Nokia N70 and Nokia 6300. But while using on Samsung Champ, I am able to send an SMS only once to a certain number i.e. it works fine when sending SMS to a number but it does not work when the same or a different SMS is sent to the SAME number. It does not give any exception(s) or error(s). Here is the code I am using:
public boolean sendSMS(String contactNum, String payloadText) {
try {
String addr = "sms://" + contactNum;
MessageConnection conn = (MessageConnection) Connector.open(addr);
TextMessage msg = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE);
msg.setPayloadText(payloadText);
if (conn.numberOfSegments(msg) == 0) {
return false;
}
conn.send(msg);
} catch (Exception e) {
new AlertDialog("Exception", "Exception in sendSMS() occurred", "OK").show();
}
return true;
}
Please somebody guide me in this regard.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为问题与短信端口有关。不建议使用 port=0(又名电话 SMS INBOX 端口号)。有些型号甚至限制端口 #0 的使用。所以尝试使用其他端口,例如5000左右。但在这种情况下,SMS 不会定向到 SMS INBOX,因此您必须编写另一个 midlet,它将在端口:5000 上侦听传入的 SMS
I suppose problem related to SMS port. It's not recommended to use port=0 (aka phone SMS INBOX port number). Some models even restricts usage of port #0. So try to use another port, e.g. 5000 or so. But in this case SMS won't be directed to SMS INBOX, so you have to write another midlet which will listen incoming SMS on port:5000