sampath
sampath

Reputation: 51

Get BlackBerry device phone number

In my application I want to retrive the device phone number. I used Phone.getDevicePhoneNumber(true)

It is working in the simulator, but when I test on the device it returns an empty string. Is there any other option for getting the device phone number?

I am using jde 4.5.0.

Upvotes: 2

Views: 1381

Answers (2)

Ray Vahey
Ray Vahey

Reputation: 3065

Phone.getDevicePhoneNumber(true) reads the number from the SIM card. The problem is the number isn't always on the SIM card. I've also seen cases where the wrong number is on the SIM card.

There is no guaranteed way to programmatically get the number. What I've done in the past is present the SIM card number to the user and asked them to correct/confirm it.

Upvotes: 1

Michael Donohue
Michael Donohue

Reputation: 11876

The straightforward approach would be to ask the user to enter their phone number.

Upvotes: 2

Related Questions