This is how I send an SMS with SMSLib:
if ( Service.getInstance().getServiceStatus() != ServiceStatus.STARTED )
{
myLog.append("ERR: Sending error. Failed to get instance ("+ Config.port
+") \n");
return;
}
try
{
OutboundMessage outboundMessage = new OutboundMessage(toMobile, body);
outboundMessage.setFrom(sourceAddress);
Service.getInstance().sendMessage(outboundMessage);
if (outboundMessage.getRefNo().equals(""))
{
myLog.append("ERR: Sending error. No RefNo was assigned after calling
sendMessage\n");
myLog.append("getFailureCause(): "+ outboundMessage.getFailureCause()
+"\n");
myLog.append("getMessageStatus(): "+ outboundMessage.getMessageStatus()
+"\n");
myLog.append("getStatusReport(): "+ outboundMessage.getStatusReport()
+"\n");
return; // ***
}
myLog.append("OK: sent, refNo "+ outboundMessage.getRefNo() +"\n");
}
catch (GatewayException e)
{
myLog.append("ERR: Sending error. GatewayException: "+ e +"\n");
}
catch (TimeoutException e)
{
myLog.append("ERR: Sending error. TimeoutException: "+ e +"\n");
}
catch (IOException e)
{
myLog.append("ERR: Sending error. IOException: "+ e +"\n");
}
catch (InterruptedException e)
{
myLog.append("ERR: Sending error. InterruptedException: "+ e +"\n");
}
catch (Exception e)
{
myLog.append("ERR: Sending error. Exception: "+ e +"\n");
}
When (***) happends (ie. no refNo assigned), I can't continue sending SMS.
I need to restart the connection (that is: create the Gateway again, attach
it to the "Service", etc), and then I can continue sending SMS.
What is happening?
--
You received this message because you are subscribed to the Google Groups
"SMSLib Discussion Group" group.
To view this discussion on the web visit
https://groups.google.com/d/msgid/smslib/fc594bba-30a3-40d8-8c2b-511561ac9fb8%40googlegroups.com.