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
Contributor
Posts: 30
Registered: ‎05-18-2013
My Device: Non-BlackBerry user
My Carrier: Non

Always return empty when retreive device phone number

Hi all,

 

I want to get device phone number, and i followed document in developer website, but no luck.

 

here is my code:

QString ApplicationUI::phoneNumber() {
	Phone phone;

	QMap<QString,Line> lines = phone.lines();
	foreach(Line line, lines) {
		cout << line.type() << "---" <<  line.address().toStdString() << endl;
		if (line.type() == 0)
		{
			return line.address();
		}
	}
	return "";
}

there are 2 lines in the phone, one is cellular, which always return null for address(); and other one is vchar, which always return my phone PIN code.


at the same , i get two log infos when i instance Phone:

Jul 03 15:54:29.527    com.example.Test.testDev_xample_Test30751603.20357352    default    9000    NOTICE      PpsObject::read failed to read pps data, error  "Resource temporarily unavailable"
Jul 03 15:54:29.528    com.example.Test.testDev_xample_Test30751603.20357352    default    9000    NOTICE      PpsObject::read failed to read pps data, error  "Resource temporarily unavailable"

I added libsystem and give the perssion to my app.

i have no idea now.

 

can you do me a favor?


Thanks.

 

-Landy

 

Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: Always return empty when retreive device phone number

Did you ask for the access_phone permission?

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Contributor
Posts: 30
Registered: ‎05-18-2013
My Device: Non-BlackBerry user
My Carrier: Non

Re: Always return empty when retreive device phone number

yes, absolutely.
I am in China, where BB10 devices are not sold. I am not sure if it caused by this.
but at least, i should get some string from simulator in my opinion.but no luck.
Contributor
Posts: 30
Registered: ‎05-18-2013
My Device: Non-BlackBerry user
My Carrier: Non

Re: Always return empty when retreive device phone number

new start point.

i set my phone number in SIM card management, then i can get device phone number...

but i think this is strange. isn't that phone number should be updated automaticly?

if i set a wrong phone number in SIM card, isn't that i will get a wrong number when i want to retreive my phone number?

 

Developer
Posts: 17,011
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Always return empty when retreive device phone number

it was the same on old BBs, only the number set by the user was retrievable.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
Posts: 30
Registered: ‎05-18-2013
My Device: Non-BlackBerry user
My Carrier: Non

Re: Always return empty when retreive device phone number

But i think this is not correct.
take an example, i need phone number as important data to verify user, then if user set a wrong number, what happens? i can not get correct phone number, then the verification fails.
i don't think RIM will do some foolish design like this. so i guess there must be some other way to get a correct and fixed phone number, from device but user settings.
Developer
Posts: 17,011
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Always return empty when retreive device phone number

log it as a bug if you think it is one. or as a feature request if you think it needed.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
Posts: 30
Registered: ‎05-18-2013
My Device: Non-BlackBerry user
My Carrier: Non

Re: Always return empty when retreive device phone number

how to do that? i mean log it as a bug or request as a new feature.
BTW, before do that, i need to confirm there is no other way to do that.
Developer
Posts: 17,011
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Always return empty when retreive device phone number

you do that on jira:
https://www.blackberry.com/jira/secure/Dashboard.jspa
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Highlighted
Contributor
Posts: 30
Registered: ‎05-18-2013
My Device: Non-BlackBerry user
My Carrier: Non

Re: Always return empty when retreive device phone number

got it.
when i confirm that there is another way to get phone number, i will do that.