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
New Contributor
nhuang
Posts: 8
Registered: ‎09-27-2012
My Device: BB 10 Dev Alpha
My Carrier: Roger

Does anyone know how to get BB10's OS version, Phone number and Carrier information through API?

AS title.

 

 

 

Please use plain text.
Developer
borceg
Posts: 671
Registered: ‎03-21-2012
My Device: BlackBerry PlayBook 16GB
My Carrier: Vip

Re: Does anyone know how to get BB10's OS version, Phone number and Carrier information through API?

[ Edited ]
Please use plain text.
New Contributor
nhuang
Posts: 8
Registered: ‎09-27-2012
My Device: BB 10 Dev Alpha
My Carrier: Roger

Re: Does anyone know how to get BB10's OS version, Phone number and Carrier information through API?

[ Edited ]

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

bb::device::HardwareInfo hardware;

 

 

data.insert("carrier", phone.activeLine().description());

data.insert("phoneNumber", phone.activeLine().address());

data.insert("phoneType", hardware.deviceName());

 

This three fields returned a empty string on Dev Alpha device and Simulator.

"carrier":null

"phoneNumber":null

"phoneType":null

Please use plain text.
New Contributor
nhuang
Posts: 8
Registered: ‎09-27-2012
My Device: BB 10 Dev Alpha
My Carrier: Roger

Re: Does anyone know how to get BB10's OS version, Phone number and Carrier information through API?

bb::

PackageInfo packageInfo;

 

data.insert(

"osVersion", packageInfo.systemDependency());

 

 

This can get

"osVersion":"10.0.9.0"

Please use plain text.
Developer
borceg
Posts: 671
Registered: ‎03-21-2012
My Device: BlackBerry PlayBook 16GB
My Carrier: Vip

Re: Does anyone know how to get BB10's OS version, Phone number and Carrier information through API?

This should check whether phone data(carrier, phone number etc) is available https://developer.blackberry.com/cascades/reference/bb__system__phone__phone.html#islineavailable

but I don't know whether the api is supported on hardware.
Please use plain text.
Developer
noahhuang
Posts: 100
Registered: ‎10-01-2012
My Device: BB10 Dev Alpha
My Carrier: Roger

Re: Does anyone know how to get BB10's OS version, Phone number and Carrier information through API?

From the setting function --> general

I can see the phone number, provider... all the information I need. Just cannot get it from API.

 

Not sure, cause by this is a dev device or not..

Please use plain text.
New Contributor
flyingVee75
Posts: 5
Registered: ‎11-08-2012
My Device: BB10 Dev Alpha
My Carrier: Vodafone

Re: Does anyone know how to get BB10's OS version, Phone number and Carrier information through API?

You can obtain the OS version by using the BlackBerry Platform Services API to obtain deviceinfo, which in turn can be used to obtain OS version:

 

http://developer.blackberry.com/native/beta/reference/com.qnx.doc.bps.lib_ref/com.qnx.doc.bps.lib_re...

 

http://developer.blackberry.com/native/beta/reference/com.qnx.doc.bps.lib_ref/com.qnx.doc.bps.lib_re...

Please use plain text.
Developer
noahhuang
Posts: 100
Registered: ‎10-01-2012
My Device: BB10 Dev Alpha
My Carrier: Roger

Re: Does anyone know how to get BB10's OS version, Phone number and Carrier information through API?

Thank you. I can get OS version, but I can not get these three

 

data.insert("carrier", phone.activeLine().description());

data.insert("phoneNumber", phone.activeLine().address());

data.insert("phoneType", hardware.deviceName());

Please use plain text.
New Contributor
flyingVee75
Posts: 5
Registered: ‎11-08-2012
My Device: BB10 Dev Alpha
My Carrier: Vodafone

Re: Does anyone know how to get BB10's OS version, Phone number and Carrier information through API?

You should be able to retrieve the device name using the HardwareInfo API call deviceName()

https://developer.blackberry.com/cascades/reference/bb__device__hardwareinfo.html

 

...and you can get hold of the network code using the SimCardInfo API call mobileNetworkCode()

https://developer.blackberry.com/cascades/reference/bb__device__simcardinfo.html

 

...and for phone number, it looks like Line.address() is what you're after.  You can get hold of the Line object using the Phone API

https://developer.blackberry.com/cascades/reference/bb__system__phone__phone.html

https://developer.blackberry.com/cascades/reference/bb__system__phone__line.html

 

Please 'like' if this assists you.

 

Please use plain text.
New Contributor
flyingVee75
Posts: 5
Registered: ‎11-08-2012
My Device: BB10 Dev Alpha
My Carrier: Vodafone

Re: Does anyone know how to get BB10's OS version, Phone number and Carrier information through API?

Just to clarify, using the SimCardInfo API, you'll need to map the mobileNetworkCode (MNC) in combination with the mobileCountryCode (MCC) to a list of carriers if it's the verbose name of the carrier company that you're after.

http://en.wikipedia.org/wiki/Mobile_Network_Code

Please use plain text.