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
Developer
sujachristy
Posts: 63
Registered: ‎12-10-2012
My Device: Blackberry 9900
My Carrier: Vodafone-in
Accepted Solution

ReferenceError can't find variable blackberry BB10

[ Edited ]

This is my code and its not working I get refenceerror can't find variable

 

 

<p id="details" > </p>
<script type="text/javascript">
function onWindowStateChange(state) 
{ 
alert("Window state was changed to: " + state);
}
try{blackberry.event.addEventListener("windowstatechanged", onWindowStateChange);}
catch(e)
{alert(e);}
</script>

 my config.xml 

<rim:permissions>
		<rim:permit>read_device_identifying_information</rim:permit>
		<rim:permit>access_internet</rim:permit>
	</rim:permissions> 
	<!--<feature id="blackberry.app" />
	<feature id="blackberry.app">
		<param name="orientation" value="portrait" />
	</feature>-->
	
	<feature id="blackberry.app.orientation">
      <param name="mode" value="portrait" />
    </feature>
    
	<feature id="blackberry.app" />  
	
	
	<content src="trial.html" />
	
	<access uri="mywebdomain.me.in" subdomains="true">
    <feature id="blackberry.app" required="true" version="1.0.0"/>
    <feature id="blackberry.invoke" required="true" version="1.0.0"/>
  </access>

////////////////////////////////////////////////////////////////////////////////////EDIT//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

I went through  this question but didn't help.

 

 

 

 

Any help is appreciated 

Thanks in advance.

 

_______________________________________________________
Help is available everywhere but you have to look at the correct place.
By Me :-)
Please use plain text.
Developer
interfaSys
Posts: 817
Registered: ‎11-19-2009
My Device: Z10, Q10, 9900, 9790, PlayBook,
My Carrier: T-Mobile UK, Three, O2, Orange, Sunrise, Swisscom

Re: ReferenceError can't find variable blackberry BB10

Are you sure that you're listening to the webworksready event before calling blackberry.event.addEventListener?

--
Olivier - interfaSys ltd
Developing for BlackBerry 10 devices using the Sencha Touch framework.
Please use plain text.
BlackBerry Development Advisor (Retired)
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: ReferenceError can't find variable blackberry BB10

Yes, I think that would be the issue.  The webworks.js file that you must include in your project fires a webworksready event when all the blackberry.* objects have been loaded into memory.  if you try to access those objects before the events has been fired, I expect you will get an "undefined" error.

 

See the "Update your app source code to accommodate changes in the BlackBerry WebWorks APIs" section on this page:

 

http://developer.blackberry.com/html5/documentation/porting_apps_playbook_tablet_os_blackberry_webwo...

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.