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
Highlighted
Developer
Posts: 131
Registered: ‎03-25-2009
My Device: Z30
My Carrier: Telus
Accepted Solution

can't access blackberry.io api in application?

[ Edited ]

My config file looks like this:

<?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">
  <name>App Name</name>
  <author>My Name</author>
  <content src="html/index.html"/>
  <feature id="blackberry.app"/>
  <rim:permissions>
	  <rim:permit>access_shared</rim:permit>
  </rim:permissions>
  <feature id="blackberry.io.file" required="true"/>
  <feature id="blackberry.io.dir" required="true"/>
</widget>

I am trying to list the app dirs:

but in my javascript when I do this:

var dirs = blackberry.io.dir.appDirs;

 I get an error in the Ripple console saying: "ReferenceError: Can't find variable: blackberry".

 

 Ripple info is:

Ripple Mobile Emulator (v0.9.1) 

  • Ripple UI (v0.9.2)
  • Ripple Framework (v0.9.1)
  • Ripple Build & Deploy (v0.9.0)

 

What am I doing wrong here?

 

Developer
Posts: 131
Registered: ‎03-25-2009
My Device: Z30
My Carrier: Telus

Re: can't access blackberry.io api in application?

Actually it seams the problem is actually that the page load event is being triggered twice.  The first time BB is not defined, the second time it is. Not sure why the load happens twice.

~S

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: can't access blackberry.io api in application?

Yes, Ripple does load itself twice.  It has to do with capturing a missing event that is needed for page navigation.

 

Where and how (code snippet please) are you calling your code?  Is it part of your page onload event, or before?

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Developer
Posts: 131
Registered: ‎03-25-2009
My Device: Z30
My Carrier: Telus

Re: can't access blackberry.io api in application?

I started another thread with a better title.  But I was using $(document).ready(....).  You can see the solution I used in the other thread, but basically I just wrapped it in a setTimout();