BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 10-28-2009, 02:35 PM   #1 (permalink)
New Member
 
Join Date: Sep 2009
Model: 8900
PIN: N/A
Carrier: Vodafone
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default IOException when using international access code (+) for sending SMS

Please Login to Remove!

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
Offline  
Closed Thread


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-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.