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

Java Development

Reply
New Developer
Posts: 54
Registered: ‎03-04-2009
My Device: Not Specified

Phone.getDevicePhoneNumber() returns null

Phone.getDevicePhoneNumber() api returns null instead of the phone number of the embedded sim unless user has set the same under Options->Advanced Options->Sim Card menu option of his phone.
Is there any other way to retrieve the user's phone number since it's not really feasible to depend on the user to set his phone number in the Sim card menu. If I have an app that relies on this phone number I have to explicitly ask user to enter his number and even detect if the sim got changed so that the new number is used. Thats really impractical for me and even the user so I wanted to know if there's any other way around this?
Developer
Posts: 146
Registered: ‎11-05-2008
My Device: Not Specified

Re: Phone.getDevicePhoneNumber() returns null

You have to stote the phone no on yyour BB(Option)!
Developer
Posts: 395
Registered: ‎12-18-2008
My Device: BlackBerry Torch 9800
My Carrier: AT&T

Re: Phone.getDevicePhoneNumber() returns null

Are you using it this way?

 

 

Phone.getDevicePhoneNumber(true)

 

 

 

 

New Developer
Posts: 54
Registered: ‎03-04-2009
My Device: Not Specified

Re: Phone.getDevicePhoneNumber() returns null

I get a null value for both Phone.getDeviceNumber(true) and Phone.getDeviceNumber(false) unless user has set the phone number in the sim card menu option as described.
Developer
Posts: 395
Registered: ‎12-18-2008
My Device: BlackBerry Torch 9800
My Carrier: AT&T

Re: Phone.getDevicePhoneNumber() returns null

Hmmm, that's interesting. I have never experienced that. Perhaps it's a carrier provisioning issue? I didn't have to program anything on my device to have the phone number be returned by that method.
Developer
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: Phone.getDevicePhoneNumber() returns null

Though John Wargo worked for RIM Smiley Wink, I would not agree with him.. In my experience, I never got phone number if it is not set in the phone manually by the user ..

 

Cheers.. 

--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: Phone.getDevicePhoneNumber() returns null

same exeprience with mantaker. I need to edit it manually in the options. but you'll only do it once. Smiley Happy
Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: Phone.getDevicePhoneNumber() returns null

do we still need to manually edit the SIMCard info in options-advance options-Sim card on BlackBerry 5.0 API? are there any other way to retrieve the phone number without manually editing the sim info?
Developer
Posts: 43
Registered: ‎01-20-2009
My Device: Not Specified

Re: Phone.getDevicePhoneNumber() returns null

The phone number on the sims are manually inserted, they can be wrong and be any number you like. They're effectively a tag and cannot be trusted to be correct. It is actually very common for SIM card to not contain the mobile number.

 

In the backend, sims are identified using IMSI, and it is this number that is used to identify sim card in the network as far as I am aware.

 

The mobile phone number are for us humans from needing to remember 15 digits and allows us to change phone number as needed on the same sim card.

Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: Phone.getDevicePhoneNumber() returns null

Hi yako,

 

Thanks for your inputs. I'm aware of that. I'm just playing around with the thought that maybe in the new 5.0 API, users dont need to manually enter it. So if you're saying that it is common for simcard not to contain the mobile number, then there's no way for the API to retrieve those information automatically. 

 

Thanks.