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: 18
Registered: ‎08-03-2011
My Device: Torch & Playbook
My Carrier: Bell

onExit Extension for playbook

IS anyone interested in creating an extension for webworks tablet SDK that incorporates an application event that catches an app exit event?  The webworks smartphone SDK has it here, https://bdsc.webapps.blackberry.com/html5/apis/blackberry.app.event.html#.onExit

 

Basically I would like to have this functionality available in the tablet SDk because right now there is no API to catch this event.  I have very limited skills when it comes to java, dabbled a bit with it, but definately don't have what I need to write my own custom extension in webworks.  I have seen the tutorial showing how to write the custom file IO api but without knowing java that well it is hard to figure out how to make this extension myself.

 

I am hoping that someone has already done this because I find it hard to believe that someone out there hasn't needed this functionality.  Thanks for the help.

 

Nick 

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: onExit Extension for playbook

We had originally created an extension for this event on PlayBook... However... Unlike the smartphone the PlayBook doesn't allow you to "block" the exit process of an app.  So what we ran into was firing the onExit() in the WebWorks API and then it was simply a race condition between when the application thread ended and when the JavaScript thread ended.

 

Basically your JavaScript could be busy running your code and not have a chance to finish because the application process will end.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 18
Registered: ‎08-03-2011
My Device: Torch & Playbook
My Carrier: Bell

Re: onExit Extension for playbook

Ok so what are my options for gettings this working?  This is something I need to get running for my application to run properly.  Can you point my to the proper file in the webworks tablet api that is called on exit?  Thanks for your help Tim.

 

Nick

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: onExit Extension for playbook

You don't really have a lot of options.. You would likely have to write your code in ActionScript to handle the exit.  You can trap the exit in ActionScript:

 

http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/How-to-save-data-on-application-e...

 

However, if you call the WebView to execute JavaSript, that funtion will return immediately and the JavaScript will get run asynchronously.  So it will be a race condition to see if the application exits before the JavaScript executes.

 

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 18
Registered: ‎08-03-2011
My Device: Torch & Playbook
My Carrier: Bell

Re: onExit Extension for playbook

Ok thanks Tim.  I was just thinking is there a way to listen for a swipeup event in webworks?  This way I could check if its ok to close if not delay until it was ready....is this possible?  Thanks for all your help.

 

Nick

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: onExit Extension for playbook

There isn't a way in any application (AIR/WebWorks) on the PlayBook to listen for swipe-up events.  Just swipe-down.

 

The best the AIR guys have done is listen for those events outlined in the URL I posted.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 27
Registered: ‎03-20-2012
My Device: Playbook
My Carrier: Tele2

Re: onExit Extension for playbook

Well, this is "brilliant". Does this mean the only viable option is to save every time something changes?

Best webOS stock market app comes to Playbook: Top Stocks
Developer
Posts: 169
Registered: ‎03-25-2011
My Device: Playbook, Z10 L.E.
My Carrier: Vodafone NL

Re: onExit Extension for playbook

I also think this is a serious limitation of the WebWorks SDK. There's just not enough control over the application life cycle and without this kind of control, the whole experience could be badly compromised.

 

Where can we formally ask for this as a feature request?

Cheers!
Retired
Posts: 115
Registered: ‎06-06-2011
My Device: 9800
My Carrier: Rogers

Re: onExit Extension for playbook

Its hard to do because when you listen to the onExit on AIr you get the event but the WebView for the Client has been destroyed by then.

Its a timing issue.

 

So what do you want to do in an onExit call? Perhaps I can find an alternative solution for you.

 

Haven't solved this for BB10 yet but we are trying to figure it out.

@nukulb
Developer
Posts: 322
Registered: ‎08-06-2012
My Device: Dev Alpha / Playbook / Curve 9300

Re: onExit Extension for playbook

Doesn't the onBackground and onForeground (PB) and .pause and .resume (BB10) help?

https://developer.blackberry.com/html5/apis/blackberry.app.event.html

 

The way I understand it, these are fired when user swipes up causing the app to be paused.  You would want to save at this point.

If it helped you, click like. Smiley Happy