BlackBerryForums.com : Your Number One BlackBerry Community
     

»Sponsored Links


BlackBerryApps.com Best Sellers



Reply
 
LinkBack Thread Tools
  (#1 (permalink)) Old
mihaipora Offline
New Member
 
Posts: 3
Join Date: Sep 2009
Model: 8900
PIN: N/A
Carrier: Vodafone
Default IOException when using international access code (+) for sending SMS - 10-28-2009, 03:35 PM

I have the following code :
Code:
try {
  MessageConnection msgConn = (MessageConnection) Connector.open("sms://" + _receiver + ":9204");
  Message msg = msgConn.newMessage(MessageConnection.BINARY_MESSAGE);
  BinaryMessage binMsg = (BinaryMessage) msg;
  String payload = "test";
  binMsg.setPayloadData(payload.getBytes());
  msgConn.send(binMsg);
  msgConn.close();
  showMessage("Contact SMS sent.");
} catch (SecurityException se) {
  showMessage("SMS blocked by security settings. " + se.getMessage());
} catch (InterruptedIOException e) {
  showMessage("SMS delivery intrerrupted. " + e.getMessage());
} catch (IOException e) {
  showMessage("Error delivering SMS." + e.getMessage());
}
If _receiver contains a phone number without country code (eg : 0744333222) the message is sent .
If _receiver contains a phone number with country code and (+) for international access code like +40744333222 the message is not sent and IOException is raised.
If _receiver contains a phone number with country code and actual local international access code like 0040744333222 the message is sent again with no errors.

This is a very weird behaviour because people sometimes store numbers in full international format because they need them when roaming.

I thought about replacing + with 00, but this is not a general valid solution because some parts of the world use different international acces codes : 00 in Europe, 011 in Unites States and a lot more codes in Asia.

Is there a way to determine the network access code or automatically transform a phone number from the agenda to MSISDN format ?

Any other suggestions are welcome.

Thank you,
Mihai
   
Reply With Quote
Sponsored Links
Please Login or Register to Remove these Advertisements!

Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright © 2004-2009 BlackBerryFAQ.com, BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of Research In Motion Limited.