开发者

Is there a way to check if an sms message is successfully sent programmatically in j2me

开发者 https://www.devze.com 2023-03-31 17:52 出处:网络
I h开发者_如何学Goave a simple j2me application that send sms to a certain cell no and then erase a certain record once it succeed. But sometimes it fails due to several reasons like network, battery,

I h开发者_如何学Goave a simple j2me application that send sms to a certain cell no and then erase a certain record once it succeed. But sometimes it fails due to several reasons like network, battery, etc. Is there a way to validate if an sms message is successfully sent?

Thanks, czetsuya


When using a try catch on the code that will send an sms, if an exception is thrown then an error occured, else the message is sent successfully, so if you didn't got an error than it is sent successfully

You can check it in the example below:

boolean sent = false
try {
   //send the message
   sent = true;
}
catch (Exception ex) {
   sent = false;
}
if (sent) {
    //your message has been sent
}


if this line is successfully executed in this example then it must be sent else exception would be thrown

 smsconn.send(txtmessage)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号