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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Adobe AIR Development

Reply
Developer
Developer
CMY
Posts: 1,119
Registered: ‎02-10-2009
My Carrier: Verizon
Accepted Solution

ANE contexts?

Is an ANE run exclusively in each applications own context (user space) or are only some parts? What I'm wondering is if the ExtensionInitializer is run only once or does it run every time an application uses the ANE. Some functions can only be called once in the BPS library so I was placing the code there and want to make sure each call is made in the applications user space and not a global user space for the extension if this function will be called more than once.

Please use plain text.
Developer
jtegen
Posts: 6,234
Registered: ‎10-27-2010
My Carrier: AT&T

Re: ANE contexts?

ANE run in the same sandbox as the parent app. Otherwise, it would be a security nightmare.
Please use plain text.
Developer
Developer
CMY
Posts: 1,119
Registered: ‎02-10-2009
My Carrier: Verizon

Re: ANE contexts?

Ok, I was just wondering because I don't know when the Extension initializer and finalizer functions are called. Are they automatically called when the applications loads?
Please use plain text.
Developer
Innovatology
Posts: 1,136
Registered: ‎03-03-2011
My Carrier: Vodafone

Re: ANE contexts?

No.

 

The initializer is called when you callExtensionContext.createExtensionContext() from ActionScript. You normally do this in your .SWC.

 

The finalizer will be called whenever your extension goes out of scope (e.g. the reference to it is nulled, or your app is closed).

 

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
Developer
Developer
CMY
Posts: 1,119
Registered: ‎02-10-2009
My Carrier: Verizon

Re: ANE contexts?

If that's true, then the ExtensionInitializer function can be called more than once. So how do you guarantee BPS library functions are not called more than once?

I thought the ExtensionInitializer was only called once to intialize data needed by the extension and the ContextInitializer function was called each time a context was intialized.
Please use plain text.
Developer
jtegen
Posts: 6,234
Registered: ‎10-27-2010
My Carrier: AT&T

Re: ANE contexts?

You can control all that with your SWC library wrapper around the ANE. You can also add a static boolean in the ANE that gets set if the ANE has already been initialized.
Please use plain text.
Developer
Developer
CMY
Posts: 1,119
Registered: ‎02-10-2009
My Carrier: Verizon

Re: ANE contexts?

[ Edited ]

Well I just made a quick test application to check on this and ExtensionInitializer is only run once, but ContextInitializer is run each time createExtensionContext is called.

 

So it sems the ContextInitializer is only used if you want different functions available for different context/uses of your ANE but global data is shared between all of your contexts, which I can see being useful but can be a pitfall if you're not aware of this.

Please use plain text.
Developer
shawnblais
Posts: 410
Registered: ‎10-25-2010

Re: ANE contexts?

I think this was fixed in AIR 3.4... I remember some reported bugs regarding issues with conflicting initialzier/finalizer calls when including multiple ANE's.

Please use plain text.