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

Web and WebWorks Development

Reply
Contributor
Posts: 10
Registered: ‎03-27-2012
My Device: Curve 8900
My Carrier: Tmn

blackberry.identity.phone doesn't work

Hello,

 I'm with a doubt related to blackberry.identity.phone
 
 bdsc.webapps.blackberry.com/html5/apis/blackberry.identity.phone.html when we use this we received the error in ''Result of expression ['Ctor'] is undefined is not an object
 
 When I tried your example, it simple didn't work
Contributor
Posts: 44
Registered: ‎12-01-2009
My Device: Not Specified

Re: blackberry.identity.phone doesn't work

Can you please ensure that you had the right permissions associated to the sample?

Also, did you try this on a live device or a simulator?

Third, was this the code sample you tried?
<script type="text/javascript">
var lines = blackberry.identity.phone.getLineIds();
for (var i = 0; i < lines.length-1; i++) {
alert("Line id : " + lines[i] + " has phone number : " + blackberry.identity.phone.getLineNumber(lines[i]));
}
&lt;/script&gt;
Contributor
Posts: 10
Registered: ‎03-27-2012
My Device: Curve 8900
My Carrier: Tmn

Re: blackberry.identity.phone doesn't work

Hello Ranaman,

 thanks for your reply, this are the permissions that I have

 

The permissions are:

  <feature id="blackberry.system" required="true" version="1.0.0.0" />

  <feature id="org.apache.cordova" required="true" version="1.0.0" />

  <feature id="blackberry.find" required="true" version="1.0.0.0" />

  <feature id="blackberry.identity" required="true" version="1.0.0.0" />

  <feature id="blackberry.identity.phone"/>

  <feature id="blackberry.pim.Address" required="true" version="1.0.0.0" />

  <feature id="blackberry.pim.Contact" required="true" version="1.0.0.0" />

  <feature id="blackberry.io.file" required="true" version="1.0.0.0" />"

  <feature id="blackberry.utils" required="true" version="1.0.0.0" />

  <feature id="blackberry.io.dir" required="true" version="1.0.0.0" />

  <feature id="blackberry.app" required="true" version="1.0.0.0" />

  <feature id="blackberry.app.event" required="true" version="1.0.0.0" />

  <feature id="blackberry.system.event" required="true" version="1.0.0.0"/>

  <feature id="blackberry.widgetcache" required="true" version="1.0.0.0"/>

  <feature id="blackberry.ui.dialog" />

 

I tried in a live device and in a simulator, and I used the code that you had entered. So I was expecting that application work, but unfortunely it doesn't work.

 

Regards

 

Yes was that code that I used.

Contributor
Posts: 44
Registered: ‎12-01-2009
My Device: Not Specified

Re: blackberry.identity.phone doesn't work

Hi Frombo... 

 

I am stumped. 

 

Can you please make a new project and try out the following? I just made this very very simple hello world app using the following index.html file and config.xml file and it worked in ripple with no issues at all...

 

HTML

*****************************

<!DOCTYPE html>
<html>
<head>

<script type="text/javascript">
var lines = blackberry.identity.phone.getLineIds();
for (var i = 0; i < lines.length-1; i++) {
alert("Line id : " + lines[i] + " has phone number : " + blackberry.identity.phone.getLineNumber(lines[i]));
}
alert("Done");
</script>


<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,initial-scale=1.0">
<title> Hello World </title>
</head>
<body>
<p>Hello World</p>
</body>
</html>

*********************

 

 

Config.xml

*********************

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:rim="http://www.blackberry.com/ns/widgets"
version="1.0.0.0" rim:header="WebWorks Sample">

<name>Hello World</name>
<description>This is a sample application.</description>
<content src="index.html"/>

<feature id="blackberry.identity.phone" />
</widget>

*********************

Contributor
Posts: 11
Registered: ‎07-30-2012
My Device: 9900
My Carrier: work

Re: blackberry.identity.phone doesn't work

Has anybody been able to make this code work?  I've tried many variations and, when I get it to run, the result is always that phone is undefined.

Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: blackberry.identity.phone doesn't work

Can you confirm which SDK you are packaging the application with? This is a BBOS only API. It's not going to work on BB10 or PlayBook.

Tim Windsor
Open Source Technical Lead