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

Native Development

Reply
Developer
nemory
Posts: 217
Registered: ‎05-21-2012
My Device: BlackBerry RED Z10
My Carrier: WiFi
Accepted Solution

[HELP] Read SIM Mobile Number?

I have already looked through all the APIs here. https://developer.blackberry.com/native/reference/cascades/device_and_communication_radio_and_sim.ht...

 

And can't find any APIs to get the SIM Card Number. Anyone knows would share please?

Please use plain text.
Retired
mwoolley
Posts: 571
Registered: ‎06-25-2010
My Device: Z10
My Carrier: Vodafone

Re: [HELP] Read SIM Mobile Number?

[ Edited ]

Which number are you looking for? The MSISDN? Or the SIM card serial number?

 

The SIM serial number is available from SimCardInfo: https://developer.blackberry.com/native/reference/cascades/bb__device__simcardinfo.html#property-ser...

 

The MSISDN (mobile phone number) *may* be available from Line::address()

 

https://developer.blackberry.com/native/reference/cascades/bb__system__phone__line.html#function-add...

 

Note that Line objects are acquired from a Phone object.

 

*May* because it depends whether or not the SIM has the MSISDN set in a readable form... not all SIMs do and the carrier generally controls this.

 

There's another way to get the phone number as well. See half way down this page:

 

http://developer.blackberry.com/native/documentation/cascades/device_comm/phone/index.html

 

Regards

 

Martin

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Please use plain text.
Developer
nemory
Posts: 217
Registered: ‎05-21-2012
My Device: BlackBerry RED Z10
My Carrier: WiFi

Re: [HELP] Read SIM Mobile Number?

Thank you for the help. I want the Mobile Phone Number. I tried with a Phone object and with a line object, but returns blank. My Phone can read my simcard number if I go to the settngs > about of my phone. which means it supports reading the mobile number of the sim. Does the Phone and Line only return a phone number if the line is active or somebody is calling the phone?
Please use plain text.
Contributor
bryanwang
Posts: 22
Registered: ‎03-01-2010
My Device: Z10
My Carrier: Bell Canada

Re: [HELP] Read SIM Mobile Number?

    QString value;

    bb::system::Phone::Phone phone;

    bb::system::Phone::Line line = phone.activeLine();

    value = line.address();

 

 

The above code works for me when not on an active call. 

Please use plain text.
Developer
nemory
Posts: 217
Registered: ‎05-21-2012
My Device: BlackBerry RED Z10
My Carrier: WiFi

Re: [HELP] Read SIM Mobile Number?

This worked!!! thanks a lot bryanwang!!! :smileyhappy:
Please use plain text.