Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

BlackBerry® Curve™

Reply
Developer
Posts: 18
Registered: ‎08-01-2008
My Device: Blackberry Curve 8900
My Carrier: Bharti Airtel India
Accepted Solution

Issue of special char in PhoneCall getDisplayPhoneNumber() OS 4.6.1.199

Hi All,

 

I've had a problem with Blackberry 8900 simulator as well as device having OS v4.6.1.199. The issue is with Phone API.

 

I was writing some logic to handling outgoing call, so I used PhoneListener and simply handled the callInitiated() method as follows.


public void callInitiated(int callid) {
PhoneCall call = Phone.getCall(callid);
String calledNumber = call.getDisplayPhoneNumber();
if (calledNumber != null && calledNumber.trim().length() > 0) {
if("15245".equals(calledNumber){
//--do something--
}else if("15246".equals(calledNumber){
//--do something--
}
}
}



The strange thing was it worked normally on OS 4.2, but when tried on OS 4.6 and higher, both conditions failed to match, even when the number was exactly same (i.e. 15245 or 15246). Later on when I investigated it further, I found the strange thing. The calledNumber was having a special character a.k.a LEFT-TO-RIGHT MARK in Unicode Character set. (for more info: read this)

When printed on console using System.out.println(), it prints '?' and is int 8206. So I had to put a special logic to this special problem and solved it.

I hope this help someone having the same problem. Though I am posting it here to know if I am right and is it a known Issue with Blackberry OS 4.6.1.199 or not.

 

Regards,

Sameer.

 

Do what you love.. Love what you do.. :smileyvery-happy:
Developer
Posts: 46
Registered: ‎06-11-2009
My Device: Bold 2 - Pearl 8120

Re: Issue of special char in PhoneCall getDisplayPhoneNumber() OS 4.6.1.199

Hi,

    Could you solve this?, because I have the same problem.

 

Thanks

 

Regards,

If your issue is resolved, please mark this thread as solved. Click "Accept as solution" on the post that contains the answer to your question.
Developer
Posts: 18
Registered: ‎08-01-2008
My Device: Blackberry Curve 8900
My Carrier: Bharti Airtel India

Re: Issue of special char in PhoneCall getDisplayPhoneNumber() OS 4.6.1.199

Yes, the solution was very simple, just observe that the first character in the display phone no is something like "?" So if you try to pick that character and convert it to int, you'll get 8206.

So the solution is just take the charAt(0).
Then compare it with 8206 and if present remove that char from the phone no string. Then use the rest of the string that will be your original displayed phone no.

Regards,
Sameer.

Do what you love.. Love what you do.. :smileyvery-happy: